Change kmalloc to kmalloc_array and rearrange statement
cover Change kmalloc to kmalloc_array and rearrange statement
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(-)
Signature · 1 line
2.5.0
PATCH 1/2 staging: wilc1000: Use kmalloc_array instead of kmalloc
Use kmalloc_array instead of kmalloc for arrays to prevent integer overflows.
--- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +1 -1
@@ -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;
Signature · 1 line
2.5.0
Re: [Outreachy kernel] [PATCH 1/2] staging: wilc1000: Use kmalloc_array instead of kmalloc
Quoted 2 lines · Janani Ravichandran
Use
kmalloc_arrayinstead 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
Quoted 29 lines
Signed-off-by Janani Ravichandran <[email protected]>--- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +1
-2@@ -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 [email protected].
To post to this group, send email to [email protected].
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.
PATCH 2/2 staging: wilc1000: Rearrange statement to respect 80 char limit
In reply to Janani RavichandranSplit statement across multiple lines as the line modified is over 80 chars in length.
--- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +4 -1
@@ -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;
Signature · 1 line
2.5.0