From nobody Mon Sep 28 05:45:31 2026 Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E3AD739902B for ; Wed, 26 Aug 2026 06:15:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787724937; cv=none; b=H4MuECPiRM/1KpkU62/Jb6dRpMB2XJuYBdv+VVglVYPrS4xItyGZ3+4uMAZAEcBf/GYo2JC0tyaupOmGOtuWDXJoi1mRRidQWO5hagxqIuaSWS97Ez9HsKtXFCn8s+tLOKwT3bfazXzUYfLySpsNIp/8ildiP8NUCC9TbQzh5MU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787724937; c=relaxed/simple; bh=bEgZ/lO0dQl/Gk12BJFJKAn5h5zpT8Qua2XOyb7g5x4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=LwdDc5sgOY+tQ4SR1ZW55zkEUNL1V3MekB6ax/pwE9LfHIskMiGPqZYa1nshU1ZqtQl77iesB/5MrGsH6zp1h6i7/xPELLbKocfAzRwwPJYU4PjwlhjhGh1UVgueS+FUp+w8+OhHBjfOoKjuxKNITPO6ocIUvsHgztbOLc9U4gY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=r5G6WdPR; arc=none smtp.client-ip=209.85.216.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="r5G6WdPR" Received: by mail-pj1-f45.google.com with SMTP id 98e67ed59e1d1-38a0c7e841fso1091021a91.2 for ; Tue, 25 Aug 2026 23:15:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787724934; x=1788329734; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=IFxcZ1IROsPv4rceYm+aT5Ud3Cuqd0ESuqG9hhc5tu4=; b=r5G6WdPRqeR7DXeVDDY0NCdfkRicsVPQG4tQmrPfDi+I8X5ZUFZ8JNMi22xruwjDe5 chzQV4fm9FRuRIii29yHBB2VbVRUAKQOl4zA933s5qRvt065hMlbiYc1DYaAaOyw3IPS qaihU7/606uIg5S1jEHHFcsR1zrd8M4snD5gmh0RvFegCwQELqINBTJU4F/fmalILxlS S3Juu+hACkZwwwMUDpRQ6/gZOD8cmSJ0338d03+ieeCcvZt0TGXd3K9InPUZXrKHJ81K TQUEtGSr2j99FNNf5dXM4rh9Pq+u3YEe/GqetnRo8jBHrs+R9R03SPbEm0tjJ4nBFRUt MeDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787724934; x=1788329734; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=IFxcZ1IROsPv4rceYm+aT5Ud3Cuqd0ESuqG9hhc5tu4=; b=Tyati0yTR90T7PdyIM6x406y0z+ZEsRYun1VzTTp9+yvkIJzgjxx97LRka5QqJVbMZ WkaD25926zEiiLZoE29gdcA9QAbq/bTKKipofbloW+8Yvpv/MMR6GUivTJC2yFowSD+2 AyMJXr4yEM7jgTw0vJ39AZ6KfJgqEel4+FdBMcZapHps16PNJevZLU2TTHFE7cyQ0Ztz Yo2end2wQl7/auZ/konHR2tr/0B0m+CgmSqVynJl0QvATFEoVMgqOOQpXH12Cxxw0bLW rAEhbpl+lg/2MeSawiPtj2PfSXoDzpajDfphYqeqv//7cfd+btJvpyYR46dI8/Hj2Jno 2w8Q== X-Forwarded-Encrypted: i=1; AHgh+RoZuaDMecd+hqRVQLqi9q9WCniBitBMWqAS9/JL309+ALkPsqwTs5HMmGPwmAHCpUcFw/Y+7tiGHl1Qaqk=@vger.kernel.org X-Gm-Message-State: AFuF++mW6q1ysTFswqT8jxGLK+xdU+T9qSkH/JNhP9nnW6CXevI5F7vE jPuy0Ni7ugNGFvMJlSpA5I/p/X49lt75P1f3BaIHT+N5ir+14E6nOpFp X-Gm-Gg: AR+sD12CGJ+oGOt5xXniNSk8CShSgEaxWqggiCZPogk0+rN1+Z5tyX5Gzzul8dju38R 69lowx12Ym0hPH/6pV5j/E2SjZFUUIuETtY93h/BRGv/YNy8pqStal7c9++LPbTlARrt3UPIf4M fhD/ikZ5xbc8In3EWH7dT3BoLPkYZJdo/UQsNW6y329JZlSPC6ags7WMewFRxh5qKSTy6lnzcDu VCeWtH/HSjF4rlx7lpM5ob0j2S3R72X7GsHExZn1cpBFdlPuQYuzAA1IPZkSIdvQ7ETmbp4HajS b2l2Qbkga/buSGplKI1pESQ7q0po/Uy7G17espqduVOFxZqmhIV8byAI+XrgFKer2wJjqNVjyH3 vecALUoxGqoe212nMlu4f7rIh2407aIAZMJ88XIfR2ZVhibZJHiLRBhxbyMFkqXJ29Vzq/QxIBX kk47o7myUR8FFWOyBC+8oT5wSVX9BK3/6ISemA1EKfGKODJ5H4ghm1YWvZuJNKpiSZ7SwmllCX1 m05LqeKlO8bAf8yhXy6a2XIOKs= X-Received: by 2002:a17:90b:1e4f:b0:38d:ef48:b04 with SMTP id 98e67ed59e1d1-3966d5f8eaamr8803881a91.10.1787724934185; Tue, 25 Aug 2026 23:15:34 -0700 (PDT) Received: from Anshuman ([103.161.223.14]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3283d885fb6sm5192046eec.14.2026.08.25.23.15.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Aug 2026 23:15:33 -0700 (PDT) From: Anshuman To: Andrew Morton , David Hildenbrand Cc: Lorenzo Stoakes , "Liam R . Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Shuah Khan , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Anshuman Subject: [PATCH] selftests/mm: fix line buffer leak in mremap_test is_range_mapped() Date: Wed, 26 Aug 2026 11:43:00 +0530 Message-ID: <20260826061300.14038-1-anshumantewari123@gmail.com> X-Mailer: git-send-email 2.55.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" is_range_mapped() uses getline() to read /proc/self/maps line by line, but never frees the buffer it allocates. Every exit path (parse failure, match found, or reaching EOF) returns without calling free(line), leaking the buffer on each call. The function is called multiple times in this test, so the leak accumulates across calls. Free line before returning. Signed-off-by: Anshuman Acked-by: David Hildenbrand (Arm) Reviewed-by: SJ Park --- tools/testing/selftests/mm/mremap_test.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/mm/mremap_test.c b/tools/testing/selft= ests/mm/mremap_test.c index 131d9d6db..779ef2d5f 100644 --- a/tools/testing/selftests/mm/mremap_test.c +++ b/tools/testing/selftests/mm/mremap_test.c @@ -156,6 +156,7 @@ static bool is_range_mapped(FILE *maps_fp, unsigned lon= g start, } } =20 + free(line); return success; } =20 --=20 2.55.0