lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 18 Aug 2015 20:06:32 -0700
From:	Andrew Schwartzmeyer <andschwa@...rosoft.com>
To:	<netdev@...r.kernel.org>
CC:	<haiyangz@...rosoft.com>, <andschwa@...rosoft.com>
Subject: [PATCH net-next] hv_netvsc: Fix dereference of nvdev before check

Passes static analysis by Smatch.

Signed-off-by: Andrew Schwartzmeyer <andschwa@...rosoft.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

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ