mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'liujing' <liujing@cmss.chinamobile.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"andreas@gaisler.com" <andreas@gaisler.com>
Cc: "sparclinux@vger.kernel.org" <sparclinux@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] sparc: Move va_end() before exit()
Date: Sun, 8 Dec 2024 11:03:23 +0000	[thread overview]
Message-ID: <b3596c1fb07e4c6bbe347e742dbb7126@AcuMS.aculab.com> (raw)
In-Reply-To: <20241206092346.6003-1-liujing@cmss.chinamobile.com>

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)


  parent reply	other threads:[~2024-12-08 11:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-06  9:23 liujing
2024-12-06 10:45 ` Andreas Larsson
2024-12-08 11:03 ` David Laight [this message]
2024-12-08 12:17   ` Thomas Weißschuh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b3596c1fb07e4c6bbe347e742dbb7126@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=andreas@gaisler.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liujing@cmss.chinamobile.com \
    --cc=sparclinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®