staging: wilc1000: allocate less memory
Subsystems (2)
PATCH 1/1 staging: wilc1000: allocate less memory
We should be allocating space for hidden_network_info structs. They are slightly smaller than hidden_network structs. This bug doesn't cause a runtime issue beyond the very small ammount of extra memory used.
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +2 -2
@@ -581,8 +581,8 @@ wilc_wfi_cfg_alloc_fill_ssid(struct cfg80211_scan_request *request,int i;int slot_id =0 ; - ntwk->net_info =kcalloc (request->n_ssids, -sizeof (struct hidden_network ),GFP_KERNEL ); + ntwk->net_info =kcalloc (request->n_ssids,sizeof (*ntwk->net_info), +GFP_KERNEL );if (!ntwk->net_info) goto out;
Quoted 6 lines · On Thu, 3 May 2018 13:56:55 +0300 Dan Carpenter <[email protected]>…
We should be allocating space for
hidden_network_infostructs. They are slightly smaller thanhidden_networkstructs. This bug doesn't cause a runtime issue beyond the very small ammount of extra memory used.Signed-off-by Dan Carpenter <[email protected]>
Thanks for submitting the changes by using correct structure size for memory allocation.
Quoted 22 lines
(quoted diff) +0
-0
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.cindex3ca0c97b0627..92322d6f061d100644 ---a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c+++b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c@@ -581,8 +581,8 @@ wilc_wfi_cfg_alloc_fill_ssid(structcfg80211_scan_request*request, int i; intslot_id= 0;(quoted diff) +0
-2- ntwk->net_info = kcalloc(request->n_ssids, - sizeof(struct hidden_network),
GFP_KERNEL);(quoted diff) +1
-0+ ntwk->net_info = kcalloc(request->n_ssids,
sizeof(*ntwk->net_info),drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +1
-0+ GFP_KERNEL);if (!ntwk->net_info) goto out;_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel