[PATCH v1] libertas: avoid potential null-pointer dereference

Andy Shevchenko andy.shevchenko at gmail.com
Wed Jan 7 15:18:41 PST 2015


We have to check pointer before dereferencing it.

Reported-by: Andrey Karpov <karpov at viva64.com>
Signed-off-by: Andy Shevchenko <andy.shevchenko at gmail.com>
---
 drivers/net/wireless/libertas/cfg.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c
index 34f09ef..1d335e6 100644
--- a/drivers/net/wireless/libertas/cfg.c
+++ b/drivers/net/wireless/libertas/cfg.c
@@ -1109,7 +1109,7 @@ static int lbs_associate(struct lbs_private *priv,
 	size_t len, resp_ie_len;
 	int status;
 	int ret;
-	u8 *pos = &(cmd->iebuf[0]);
+	u8 *pos;
 	u8 *tmp;
 
 	lbs_deb_enter(LBS_DEB_CFG80211);
@@ -1138,6 +1138,8 @@ static int lbs_associate(struct lbs_private *priv,
 	cmd->listeninterval = cpu_to_le16(MRVDRV_DEFAULT_LISTEN_INTERVAL);
 	cmd->capability = cpu_to_le16(bss->capability);
 
+	pos = cmd->iebuf;
+
 	/* add SSID TLV */
 	rcu_read_lock();
 	ssid_eid = ieee80211_bss_get_ie(bss, WLAN_EID_SSID);
-- 
1.8.3.101.g727a46b




More information about the libertas-dev mailing list