* [PATCH] sparc: Move va_end() before exit()
@ 2024-12-06 9:23 liujing
2024-12-06 10:45 ` Andreas Larsson
2024-12-08 11:03 ` David Laight
0 siblings, 2 replies; 4+ messages in thread
From: liujing @ 2024-12-06 9:23 UTC (permalink / raw)
To: davem, andreas; +Cc: sparclinux, linux-kernel, liujing
There is a static checker warning, so move the va_end call before
exit(1). Since the exit(1) function terminates the program, any code
after exit(1) is unreachable thus notexecuted. Placing va_end() before
exit() ensures that the va_list is properly cleaned up.
Signed-off-by: liujing <liujing@cmss.chinamobile.com>
---
V1 -> V2: Modify the commit information and title description
diff --git a/arch/sparc/vdso/vdso2c.c b/arch/sparc/vdso/vdso2c.c
index dc81240aab6f..372e3330850a 100644
--- a/arch/sparc/vdso/vdso2c.c
+++ b/arch/sparc/vdso/vdso2c.c
@@ -90,8 +90,8 @@ static void fail(const char *format, ...)
vfprintf(stderr, format, ap);
if (outfilename)
unlink(outfilename);
- exit(1);
va_end(ap);
+ exit(1);
}
/*
--
2.27.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sparc: Move va_end() before exit()
2024-12-06 9:23 [PATCH] sparc: Move va_end() before exit() liujing
@ 2024-12-06 10:45 ` Andreas Larsson
2024-12-08 11:03 ` David Laight
1 sibling, 0 replies; 4+ messages in thread
From: Andreas Larsson @ 2024-12-06 10:45 UTC (permalink / raw)
To: liujing, davem; +Cc: sparclinux, linux-kernel
On 2024-12-06 10:23, liujing wrote:
> [PATCH] sparc: Move va_end() before exit()
That this is version 2 of the patch should be indicated in the subject
line as [PATCH v2]. You can use -v <n> or --reroll-count=<n> with git
format-patch to do it for you. Make sure to do that for your v3.
The description line still doesn't indicate where under sparc this
change is happening. At least start with "sparc: vdso: ...".
Thanks,
Andreas
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] sparc: Move va_end() before exit()
2024-12-06 9:23 [PATCH] sparc: Move va_end() before exit() liujing
2024-12-06 10:45 ` Andreas Larsson
@ 2024-12-08 11:03 ` David Laight
2024-12-08 12:17 ` Thomas Weißschuh
1 sibling, 1 reply; 4+ messages in thread
From: David Laight @ 2024-12-08 11:03 UTC (permalink / raw)
To: 'liujing', davem, andreas; +Cc: sparclinux, linux-kernel
From: liujing
> Sent: 06 December 2024 09:24
>
> There is a static checker warning, so move the va_end call before
> exit(1). Since the exit(1) function terminates the program, any code
> after exit(1) is unreachable thus notexecuted. Placing va_end() before
> exit() ensures that the va_list is properly cleaned up.
Aren't you just adding 'bloat' to the vdso?
(It might even be space limited?)
If you are calling exit() then there is no need to tidy up the va_list.
Much the same as there is no need to call free() or close() all fd.
I'd probably have written it as:
// va_end(ap);
exit(1);
David
>
> Signed-off-by: liujing <liujing@cmss.chinamobile.com>
> ---
> V1 -> V2: Modify the commit information and title description
>
> diff --git a/arch/sparc/vdso/vdso2c.c b/arch/sparc/vdso/vdso2c.c
> index dc81240aab6f..372e3330850a 100644
> --- a/arch/sparc/vdso/vdso2c.c
> +++ b/arch/sparc/vdso/vdso2c.c
> @@ -90,8 +90,8 @@ static void fail(const char *format, ...)
> vfprintf(stderr, format, ap);
> if (outfilename)
> unlink(outfilename);
> - exit(1);
> va_end(ap);
> + exit(1);
> }
>
> /*
> --
> 2.27.0
>
>
>
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sparc: Move va_end() before exit()
2024-12-08 11:03 ` David Laight
@ 2024-12-08 12:17 ` Thomas Weißschuh
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Weißschuh @ 2024-12-08 12:17 UTC (permalink / raw)
To: David Laight; +Cc: 'liujing', davem, andreas, sparclinux, linux-kernel
Hi David,
On 2024-12-08 11:03:23+0000, David Laight wrote:
> From: liujing
> > Sent: 06 December 2024 09:24
> >
> > There is a static checker warning, so move the va_end call before
> > exit(1). Since the exit(1) function terminates the program, any code
> > after exit(1) is unreachable thus notexecuted. Placing va_end() before
> > exit() ensures that the va_list is properly cleaned up.
>
> Aren't you just adding 'bloat' to the vdso?
> (It might even be space limited?)
This is about the build time tool "vdso2c", which converts the VDSO
binary into a C file to be compiled and linked into the kernel.
So it can't be a runtime issue.
That should probably been in the patch subject.
> If you are calling exit() then there is no need to tidy up the va_list.
> Much the same as there is no need to call free() or close() all fd.
>
> I'd probably have written it as:
> // va_end(ap);
> exit(1);
>
> David
> >
> > Signed-off-by: liujing <liujing@cmss.chinamobile.com>
> > ---
> > V1 -> V2: Modify the commit information and title description
> >
> > diff --git a/arch/sparc/vdso/vdso2c.c b/arch/sparc/vdso/vdso2c.c
> > index dc81240aab6f..372e3330850a 100644
> > --- a/arch/sparc/vdso/vdso2c.c
> > +++ b/arch/sparc/vdso/vdso2c.c
> > @@ -90,8 +90,8 @@ static void fail(const char *format, ...)
> > vfprintf(stderr, format, ap);
> > if (outfilename)
> > unlink(outfilename);
> > - exit(1);
> > va_end(ap);
> > + exit(1);
> > }
> >
> > /*
> > --
> > 2.27.0
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-12-08 12:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-06 9:23 [PATCH] sparc: Move va_end() before exit() liujing
2024-12-06 10:45 ` Andreas Larsson
2024-12-08 11:03 ` David Laight
2024-12-08 12:17 ` Thomas Weißschuh
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®