]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: wilc1000: removes potential null dereference
authorLeo Kim <leo.kim@atmel.com>
Mon, 22 Feb 2016 04:11:50 +0000 (13:11 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 22 Feb 2016 19:47:00 +0000 (11:47 -0800)
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@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c

index 76f4375bd88d3235f3d53aee14556da2ac65a35f..8a3da2d71a246ed300fb20721319fc2c1cb86480 100644 (file)
@@ -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;