* Re: [Outreachy kernel] [PATCH 1/2] staging: wilc1000: Use kmalloc_array instead of kmalloc
2016-02-16 22:24 ` [PATCH 1/2] staging: wilc1000: Use kmalloc_array instead of kmalloc Janani Ravichandran
@ 2016-02-16 17:33 ` Julia Lawall
0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2016-02-16 17:33 UTC (permalink / raw)
To: Janani Ravichandran; +Cc: outreachy-kernel
On Tue, 16 Feb 2016, Janani Ravichandran wrote:
> Use kmalloc_array instead of kmalloc for arrays to prevent integer
> overflows.
I think it should have been v2, to indicat to Greg that the original patch
was not useful.
julia
>
> Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
> ---
> drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> index 81a2ee9..7554cd4 100644
> --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> @@ -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;
>
>
> --
> 2.5.0
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/351c2cb45bd6c3f0ac54246c66b693e204c172a8.1455661012.git.janani.rvchndrn%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 0/2] Change kmalloc to kmalloc_array and rearrange statement
@ 2016-02-16 22:22 Janani Ravichandran
2016-02-16 22:24 ` [PATCH 1/2] staging: wilc1000: Use kmalloc_array instead of kmalloc Janani Ravichandran
2016-02-16 22:27 ` [PATCH 2/2] staging: wilc1000: Rearrange statement to respect 80 char limit Janani Ravichandran
0 siblings, 2 replies; 4+ messages in thread
From: Janani Ravichandran @ 2016-02-16 22:22 UTC (permalink / raw)
To: outreachy-kernel
This patchset changes a call to kmalloc to kmalloc_array and splits
the statement across multiple lines to respect the 80 char per line limit.
Janani Ravichandran (2):
staging: wilc1000: Use kmalloc_array instead of kmalloc
staging: wilc1000: Rearrange statement to respect 80 char limit
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--
2.5.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] staging: wilc1000: Use kmalloc_array instead of kmalloc
2016-02-16 22:22 [PATCH 0/2] Change kmalloc to kmalloc_array and rearrange statement Janani Ravichandran
@ 2016-02-16 22:24 ` Janani Ravichandran
2016-02-16 17:33 ` [Outreachy kernel] " Julia Lawall
2016-02-16 22:27 ` [PATCH 2/2] staging: wilc1000: Rearrange statement to respect 80 char limit Janani Ravichandran
1 sibling, 1 reply; 4+ messages in thread
From: Janani Ravichandran @ 2016-02-16 22:24 UTC (permalink / raw)
To: outreachy-kernel
Use kmalloc_array instead of kmalloc for arrays to prevent integer
overflows.
Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 81a2ee9..7554cd4 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -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;
--
2.5.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] staging: wilc1000: Rearrange statement to respect 80 char limit
2016-02-16 22:22 [PATCH 0/2] Change kmalloc to kmalloc_array and rearrange statement Janani Ravichandran
2016-02-16 22:24 ` [PATCH 1/2] staging: wilc1000: Use kmalloc_array instead of kmalloc Janani Ravichandran
@ 2016-02-16 22:27 ` Janani Ravichandran
1 sibling, 0 replies; 4+ messages in thread
From: Janani Ravichandran @ 2016-02-16 22:27 UTC (permalink / raw)
To: outreachy-kernel
Split statement across multiple lines as the line modified is over 80
chars in length.
Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 7554cd4..eeb9843 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -664,7 +664,10 @@ 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_array(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;
--
2.5.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-02-16 17:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-16 22:22 [PATCH 0/2] Change kmalloc to kmalloc_array and rearrange statement Janani Ravichandran
2016-02-16 22:24 ` [PATCH 1/2] staging: wilc1000: Use kmalloc_array instead of kmalloc Janani Ravichandran
2016-02-16 17:33 ` [Outreachy kernel] " Julia Lawall
2016-02-16 22:27 ` [PATCH 2/2] staging: wilc1000: Rearrange statement to respect 80 char limit Janani Ravichandran
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.