diff options
author | Andrew Schwartzmeyer <andschwa@microsoft.com> | 2015-08-18 20:06:32 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-08-18 20:15:01 -0700 |
commit | 954591b9f3b43e7015bdd83acaa317658a9b7048 (patch) | |
tree | 85591e0cc920e7b7ea9bf687006a99e67a6afc60 /drivers | |
parent | 2d79849903e00fb445038ddd8afb2acfbf89eb7f (diff) |
hv_netvsc: Fix dereference of nvdev before check
Passes static analysis by Smatch.
Signed-off-by: Andrew Schwartzmeyer <andschwa@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/hyperv/netvsc_drv.c | 7 |
1 files 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; |