public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Shannon Nelson <shannon.nelson@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] sparc: vDSO: Silence an uninitialized variable warning
Date: Sat, 13 Oct 2018 18:18:20 +0000	[thread overview]
Message-ID: <6122ffb9-4c61-b2da-8a89-a04fc6a1ed31@oracle.com> (raw)
In-Reply-To: <20181013102653.GE16086@mwanda>

On 10/13/2018 3:26 AM, Dan Carpenter wrote:
> Smatch complains that "val" would be uninitialized if kstrtoul() fails.
> 
> Fixes: 9a08862a5d2e ("vDSO for sparc")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>   arch/sparc/vdso/vma.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/sparc/vdso/vma.c b/arch/sparc/vdso/vma.c
> index f51595f861b8..5eaff3c1aa0c 100644
> --- a/arch/sparc/vdso/vma.c
> +++ b/arch/sparc/vdso/vma.c
> @@ -262,7 +262,9 @@ static __init int vdso_setup(char *s)
>   	unsigned long val;
>   
>   	err = kstrtoul(s, 10, &val);
> +	if (err)
> +		return err;
>   	vdso_enabled = val;
> -	return err;
> +	return 0;
>   }
>   __setup("vdso=", vdso_setup);
> 

This is probably fine, but it might be cleaner as

    	err = kstrtoul(s, 10, &val);
	if (!err)
		vdso_enabled = val;
	return err;

sln

  reply	other threads:[~2018-10-13 18:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-13 10:26 [PATCH] sparc: vDSO: Silence an uninitialized variable warning Dan Carpenter
2018-10-13 18:18 ` Shannon Nelson [this message]
2018-10-14  7:52 ` Dan Carpenter
2018-10-14 22:44 ` Shannon Nelson
2018-10-18  4:55 ` David Miller

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=6122ffb9-4c61-b2da-8a89-a04fc6a1ed31@oracle.com \
    --to=shannon.nelson@oracle.com \
    --cc=kernel-janitors@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