]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: wilc1000: Use kmalloc_array instead of kmalloc
authorJanani Ravichandran <janani.rvchndrn@gmail.com>
Tue, 16 Feb 2016 22:24:52 +0000 (17:24 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 Feb 2016 01:00:07 +0000 (17:00 -0800)
Use kmalloc_array instead of kmalloc for arrays to prevent integer
overflows.

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c

index 5649476fb8fd37ff718d713cca939927c3bb317b..cf351d1aa74b903a68b31f8d9256abfcae01103f 100644 (file)
@@ -664,7 +664,7 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
                PRINT_D(CFG80211_DBG, "Number of SSIDs %d\n", request->n_ssids);
 
                if (request->n_ssids >= 1) {
-                       strHiddenNetwork.net_info = kmalloc(request->n_ssids * sizeof(struct hidden_network), GFP_KERNEL);
+                       strHiddenNetwork.net_info = kmalloc_array(request->n_ssids, sizeof(struct hidden_network), GFP_KERNEL);
                        strHiddenNetwork.n_ssids = request->n_ssids;