[PATCH V3 05/24] staging: wilc1000: removes potential null dereference

Leo Kim leo.kim at atmel.com
Mon Feb 22 04:11:50 UTC 2016


This patch removes the error reported by smatch.
 - wilc_wfi_cfgoperations.c:674 scan() error:
   potential null dereference 'strHiddenNetwork.net_info'.  (kmalloc returns null)

Signed-off-by: Leo Kim <leo.kim at atmel.com>
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 76f4375..8a3da2d 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -668,6 +668,8 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
 				kmalloc_array(request->n_ssids,
 					      sizeof(struct hidden_network),
 					      GFP_KERNEL);
+			if (!strHiddenNetwork.net_info)
+				return -ENOMEM;
 			strHiddenNetwork.n_ssids = request->n_ssids;
 
 
-- 
1.9.1



More information about the devel mailing list