From 396fa30e4b320f235c462f9d1b1f9da87548667a Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Mon, 22 Feb 2016 13:11:50 +0900 Subject: [PATCH] staging: wilc1000: removes potential null dereference 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 Signed-off-by: Greg Kroah-Hartman --- 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 76f4375bd88d..8a3da2d71a24 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; -- 2.30.2