From: Dan Carpenter <dan.carpenter@oracle.com> To: Trond Myklebust <trond.myklebust@hammerspace.com> Cc: Anna Schumaker <anna.schumaker@netapp.com>, linux-nfs@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] NFS: silence a harmless uninitialized variable warning Date: Thu, 12 Jul 2018 12:29:29 +0000 [thread overview] Message-ID: <20180712122929.dshlwi3obipq6vfm@kili.mountain> (raw) kstrtoul() can return -ERANGE so Smatch complains that "num" can be uninitialized. We check that it's within bounds so it's not a huge deal. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> diff --git a/fs/nfs/super.c b/fs/nfs/super.c index b5f27d6999e5..d81a33461bee 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -2901,7 +2901,7 @@ static int param_set_portnr(const char *val, const struct kernel_param *kp) if (!val) return -EINVAL; ret = kstrtoul(val, 0, &num); - if (ret = -EINVAL || num > NFS_CALLBACK_MAXPORTNR) + if (ret || num > NFS_CALLBACK_MAXPORTNR) return -EINVAL; *((unsigned int *)kp->arg) = num; return 0;
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com> To: Trond Myklebust <trond.myklebust@hammerspace.com> Cc: Anna Schumaker <anna.schumaker@netapp.com>, linux-nfs@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] NFS: silence a harmless uninitialized variable warning Date: Thu, 12 Jul 2018 15:29:29 +0300 [thread overview] Message-ID: <20180712122929.dshlwi3obipq6vfm@kili.mountain> (raw) kstrtoul() can return -ERANGE so Smatch complains that "num" can be uninitialized. We check that it's within bounds so it's not a huge deal. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> diff --git a/fs/nfs/super.c b/fs/nfs/super.c index b5f27d6999e5..d81a33461bee 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -2901,7 +2901,7 @@ static int param_set_portnr(const char *val, const struct kernel_param *kp) if (!val) return -EINVAL; ret = kstrtoul(val, 0, &num); - if (ret == -EINVAL || num > NFS_CALLBACK_MAXPORTNR) + if (ret || num > NFS_CALLBACK_MAXPORTNR) return -EINVAL; *((unsigned int *)kp->arg) = num; return 0;
next reply other threads:[~2018-07-12 12:29 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-07-12 12:29 Dan Carpenter [this message] 2018-07-12 12:29 ` [PATCH] NFS: silence a harmless uninitialized variable warning Dan Carpenter
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=20180712122929.dshlwi3obipq6vfm@kili.mountain \ --to=dan.carpenter@oracle.com \ --cc=anna.schumaker@netapp.com \ --cc=kernel-janitors@vger.kernel.org \ --cc=linux-nfs@vger.kernel.org \ --cc=trond.myklebust@hammerspace.com \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.