The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] selftests/mm: khugepaged: remove str_dup() usage
@ 2026-08-25 11:20 David Hildenbrand (Arm)
  2026-08-25 11:23 ` Lorenzo Stoakes (ARM)
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: David Hildenbrand (Arm) @ 2026-08-25 11:20 UTC (permalink / raw)
  To: Andrew Morton, Lorenzo Stoakes, Zi Yan, Baolin Wang,
	Liam R. Howlett, Nico Pache, Ryan Roberts, Dev Jain, Barry Song,
	Lance Yang, Usama Arif, Vlastimil Babka, Mike Rapoport,
	Suren Baghdasaryan, Michal Hocko, Shuah Khan
  Cc: linux-mm, linux-kselftest, linux-kernel, David Hildenbrand (Arm)

We don't check str_dup() return value and never free it. While both
things are irrelevant in practice, let's just clean it up by working on
argv[0] directly and avoiding the str_dup().

Nobody after us needs these parts of the argv[0] string anyway.

This patch is inspired by previous work from Anshuman Tewari [1].

Link: https://lore.kernel.org/r/20260821114416.12255-1-anshumantewari123@gmail.com [1]
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
---
 tools/testing/selftests/mm/khugepaged.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/mm/khugepaged.c b/tools/testing/selftests/mm/khugepaged.c
index 1d2d6bd72fd2a..83d27d069c413 100644
--- a/tools/testing/selftests/mm/khugepaged.c
+++ b/tools/testing/selftests/mm/khugepaged.c
@@ -1227,7 +1227,7 @@ static void parse_test_type(int argc, char **argv)
 		return;
 	}
 
-	buf = strdup(argv[0]);
+	buf = argv[0];
 	token = strsep(&buf, ":");
 
 	if (!strcmp(token, "all")) {

---

base-commit: 169393fff5d1ec2690934067eeb95544ff5ebdd7

change-id: 20260825-remove_str_dup-bb089e93094f

--

Cheers,

David


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-08-25 13:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-25 11:20 [PATCH] selftests/mm: khugepaged: remove str_dup() usage David Hildenbrand (Arm)
2026-08-25 11:23 ` Lorenzo Stoakes (ARM)
2026-08-25 11:57 ` Zi Yan
2026-08-25 12:47 ` Lance Yang
2026-08-25 13:18 ` Dev Jain
2026-08-25 13:41 ` Usama Arif

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox