tools/testing/selftests/mm/khugepaged.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
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
On Tue, 25 Aug 2026 13:20:59 +0200 "David Hildenbrand (Arm)" <david@kernel.org> wrote: > 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]. This might be the most-reviewed patch I've every seen. > 1 file changed, 1 insertion(+), 1 deletion(-) Oh. Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
On Tue, Aug 25, 2026 at 7:21 PM David Hildenbrand (Arm) <david@kernel.org> wrote: > > 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> > --- LGTM, Reviewed-by: Barry Song <baohua@kernel.org>
On 8/25/26 7:20 PM, David Hildenbrand (Arm) wrote: > 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> > --- LGTM. Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
On 25/08/2026 12:20, David Hildenbrand (Arm) wrote: > 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(-) > Acked-by: Usama Arif <usama.arif@linux.dev>
On 25/08/26 4:50 pm, David Hildenbrand (Arm) wrote:
> 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>
> ---
LGTM
Reviewed-by: Dev Jain <dev.jain@arm.com>
> 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
On 2026/8/25 19:20, David Hildenbrand (Arm) wrote: > 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> > --- Reviewed-by: Lance Yang <lance.yang@linux.dev>
On Tue Aug 25, 2026 at 7:20 AM EDT, David Hildenbrand (Arm) wrote: > 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(-) > LGTM. Reviewed-by: Zi Yan <ziy@nvidia.com> -- Best Regards, Yan, Zi
On Tue, Aug 25, 2026 at 01:20:59PM +0200, David Hildenbrand (Arm) wrote:
> 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>
LGTM so:
Reviewed-by: Lorenzo Stoakes (ARM) <ljs@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
>
--
Cheers, Lorenzo
On Tue, Aug 25, 2026 at 01:20:59PM +0200, David Hildenbrand (Arm) wrote: > 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> LGTM, thanks for the cleaner fix. Reviewed-by: Anshuman Tewari <anshumantewari123@gmail.com>
© 2016 - 2026 Red Hat, Inc.