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]
Message-ID: <CAPgLHd97uPhcX-dTkur_Ceb=8YOwWQtbRk7MqirNvsYBbDoZ1A@mail.gmail.com>
Date:	Mon, 10 Sep 2012 12:46:46 +0800
From:	Wei Yongjun <weiyj.lk@...il.com>
To:	jussi.kivilinna@...et.fi, linville@...driver.com
Cc:	yongjun_wei@...ndmicro.com.cn, linux-wireless@...r.kernel.org,
	netdev@...r.kernel.org
Subject: [PATCH] rndis_wlan: move the dereference below the NULL test

From: Wei Yongjun <yongjun_wei@...ndmicro.com.cn>

The dereference should be moved below the NULL test.

spatch with a semantic match is used to found this.
(http://coccinelle.lip6.fr/)

Signed-off-by: Wei Yongjun <yongjun_wei@...ndmicro.com.cn>
---
 drivers/net/wireless/rndis_wlan.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index 7a4ae9e..de2a673 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -1946,12 +1946,19 @@ static int rndis_get_tx_power(struct wiphy *wiphy, int *dbm)
 static int rndis_scan(struct wiphy *wiphy,
 			struct cfg80211_scan_request *request)
 {
-	struct net_device *dev = request->wdev->netdev;
-	struct usbnet *usbdev = netdev_priv(dev);
-	struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev);
+	struct net_device *dev;
+	struct usbnet *usbdev;
+	struct rndis_wlan_private *priv;
 	int ret;
 	int delay = SCAN_DELAY_JIFFIES;
 
+	if (!request)
+		return -EINVAL;
+
+	dev = request->wdev->netdev;
+	usbdev = netdev_priv(dev);
+	priv = get_rndis_wlan_priv(usbdev);
+
 	netdev_dbg(usbdev->net, "cfg80211.scan\n");
 
 	/* Get current bssid list from device before new scan, as new scan
@@ -1959,9 +1966,6 @@ static int rndis_scan(struct wiphy *wiphy,
 	 */
 	rndis_check_bssid_list(usbdev, NULL, NULL);
 
-	if (!request)
-		return -EINVAL;
-
 	if (priv->scan_request && priv->scan_request != request)
 		return -EBUSY;
 

--
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