Re: [PATCH 2/6] Provide __free(argv) for argv_split() users
From: Steven Rostedt
Date: Mon Jan 06 2025 - 14:28:55 EST
On Sat, 4 Jan 2025 08:01:47 +0900
"Masami Hiramatsu (Google)" <mhiramat@xxxxxxxxxx> wrote:
> From: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>
>
> Provide __free(argv) macro for argv_split() users so that they can
> avoid gotos.
>
> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>
> ---
> include/linux/string.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/include/linux/string.h b/include/linux/string.h
> index 493ac4862c77..7035a70e30be 100644
> --- a/include/linux/string.h
> +++ b/include/linux/string.h
> @@ -312,6 +312,8 @@ extern void *kmemdup_array(const void *src, size_t count, size_t element_size, g
> extern char **argv_split(gfp_t gfp, const char *str, int *argcp);
> extern void argv_free(char **argv);
>
> +DEFINE_FREE(argv, char **, argv_free(_T))
> +
> /* lib/cmdline.c */
> extern int get_option(char **str, int *pint);
> extern char *get_options(const char *str, int nints, int *ints);
FYI, I already have this change in linux-next:
https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git/commit/?h=for-next&id=9e49ca756d207f4313fb7af48648a67da8e4e250
https://lore.kernel.org/20241220103313.4a74ec8e@xxxxxxxxxxxxxxxxxx
-- Steve