From: Leo Kim Date: Mon, 22 Feb 2016 04:11:50 +0000 (+0900) Subject: staging: wilc1000: removes potential null dereference X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=396fa30e4b320f235c462f9d1b1f9da87548667a;p=deliverable%2Flinux.git 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 --- 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;