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/[email protected] 
> [1]
> Signed-off-by: David Hildenbrand (Arm) <[email protected]>

LGTM so:

Reviewed-by: Lorenzo Stoakes (ARM) <[email protected]>

> ---
>  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

Reply via email to