From: Andrew Schwartzmeyer <andschwa@microsoft.com>
To: <netdev@vger.kernel.org>
Cc: <haiyangz@microsoft.com>, <andschwa@microsoft.com>
Subject: [PATCH net-next] hv_netvsc: Fix dereference of nvdev before check
Date: Tue, 18 Aug 2015 20:06:32 -0700 [thread overview]
Message-ID: <1439953592-8210-1-git-send-email-andschwa@microsoft.com> (raw)
Passes static analysis by Smatch.
Signed-off-by: Andrew Schwartzmeyer <andschwa@microsoft.com>
---
drivers/net/hyperv/netvsc_drv.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index f3b9d3eb753b..2990024b90f9 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -777,14 +777,17 @@ static int netvsc_set_channels(struct net_device *net,
struct hv_device *dev = net_device_ctx->device_ctx;
struct netvsc_device *nvdev = hv_get_drvdata(dev);
struct netvsc_device_info device_info;
- const u32 num_chn = nvdev->num_chn;
- const u32 max_chn = min_t(u32, nvdev->max_chn, num_online_cpus());
+ u32 num_chn;
+ u32 max_chn;
int ret = 0;
bool recovering = false;
if (!nvdev || nvdev->destroy)
return -ENODEV;
+ num_chn = nvdev->num_chn;
+ max_chn = min_t(u32, nvdev->max_chn, num_online_cpus());
+
if (nvdev->nvsp_version < NVSP_PROTOCOL_VERSION_5) {
pr_info("vRSS unsupported before NVSP Version 5\n");
return -EINVAL;
--
2.5.0
next reply other threads:[~2015-08-19 3:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-19 3:06 Andrew Schwartzmeyer [this message]
2015-08-19 3:15 ` [PATCH net-next] hv_netvsc: Fix dereference of nvdev before check 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=1439953592-8210-1-git-send-email-andschwa@microsoft.com \
--to=andschwa@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=netdev@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;
as well as URLs for NNTP newsgroup(s).