kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: wilc1000: allocate less memory
@ 2018-05-03 10:56 Dan Carpenter
  2018-05-04  4:56 ` Ajay Singh
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2018-05-03 10:56 UTC (permalink / raw)
  To: kernel-janitors

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.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 3ca0c97b0627..92322d6f061d 100644
--- 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(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;
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] staging: wilc1000: allocate less memory
  2018-05-03 10:56 [PATCH] staging: wilc1000: allocate less memory Dan Carpenter
@ 2018-05-04  4:56 ` Ajay Singh
  0 siblings, 0 replies; 2+ messages in thread
From: Ajay Singh @ 2018-05-04  4:56 UTC (permalink / raw)
  To: kernel-janitors


On Thu, 3 May 2018 13:56:55 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> 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.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Ajay Singh <ajay.kathat@microchip.com>

Thanks for submitting the changes by using correct structure size
for memory allocation.

> 
> diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index
> 3ca0c97b0627..92322d6f061d 100644 ---
> 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(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;
>  
> _______________________________________________
> devel mailing list
> devel@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-04  4:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-03 10:56 [PATCH] staging: wilc1000: allocate less memory Dan Carpenter
2018-05-04  4:56 ` Ajay Singh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).