* [PATCH] tools/lib/subcmd: Move va_end before exit
@ 2024-11-11 9:17 Luo Yifan
2024-11-11 17:43 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 2+ messages in thread
From: Luo Yifan @ 2024-11-11 9:17 UTC (permalink / raw)
To: jpoimboe, acme; +Cc: linux-kernel, Luo Yifan
This patch makes a minor adjustment by moving the va_end call before
exit. Since the exit() function terminates the program, any code
after exit(128) (i.e., va_end(params)) is unreachable and thus not
executed. Placing va_end before exit ensures that the va_list is
properly cleaned up.
Signed-off-by: Luo Yifan <luoyifan@cmss.chinamobile.com>
---
tools/lib/subcmd/subcmd-util.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lib/subcmd/subcmd-util.h b/tools/lib/subcmd/subcmd-util.h
index dfac76e35..c742b0881 100644
--- a/tools/lib/subcmd/subcmd-util.h
+++ b/tools/lib/subcmd/subcmd-util.h
@@ -20,8 +20,8 @@ static __noreturn inline void die(const char *err, ...)
va_start(params, err);
report(" Fatal: ", err, params);
- exit(128);
va_end(params);
+ exit(128);
}
#define zfree(ptr) ({ free(*ptr); *ptr = NULL; })
--
2.27.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] tools/lib/subcmd: Move va_end before exit
2024-11-11 9:17 [PATCH] tools/lib/subcmd: Move va_end before exit Luo Yifan
@ 2024-11-11 17:43 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-11-11 17:43 UTC (permalink / raw)
To: Luo Yifan; +Cc: jpoimboe, linux-kernel
On Mon, Nov 11, 2024 at 05:17:01PM +0800, Luo Yifan wrote:
> This patch makes a minor adjustment by moving the va_end call before
> exit. Since the exit() function terminates the program, any code
> after exit(128) (i.e., va_end(params)) is unreachable and thus not
> executed. Placing va_end before exit ensures that the va_list is
> properly cleaned up.
Thanks, applied to perf-tools-next,
- Arnaldo
> Signed-off-by: Luo Yifan <luoyifan@cmss.chinamobile.com>
> ---
> tools/lib/subcmd/subcmd-util.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/lib/subcmd/subcmd-util.h b/tools/lib/subcmd/subcmd-util.h
> index dfac76e35..c742b0881 100644
> --- a/tools/lib/subcmd/subcmd-util.h
> +++ b/tools/lib/subcmd/subcmd-util.h
> @@ -20,8 +20,8 @@ static __noreturn inline void die(const char *err, ...)
>
> va_start(params, err);
> report(" Fatal: ", err, params);
> - exit(128);
> va_end(params);
> + exit(128);
> }
>
> #define zfree(ptr) ({ free(*ptr); *ptr = NULL; })
> --
> 2.27.0
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-11-11 17:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-11 9:17 [PATCH] tools/lib/subcmd: Move va_end before exit Luo Yifan
2024-11-11 17:43 ` Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®