linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] brcmfmac: use kcalloc() to prevent integer overflow
@ 2012-09-26  7:21 Dan Carpenter
  2012-09-26  7:31 ` Dan Carpenter
  2012-09-27 10:49 ` Arend van Spriel
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2012-09-26  7:21 UTC (permalink / raw)
  To: Brett Rudley
  Cc: Roland Vossen, Arend van Spriel, Franky (Zhenhui) Lin, Kan Yan,
	John W. Linville, Hante Meuleman, linux-wireless,
	brcm80211-dev-list, kernel-janitors

The multiplication here looks like it could overflow.  I've changed it
to use kcalloc() to prevent that.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Only needed in linux-next.  This was added in e58060723c "brcmfmac:
introduce scheduled scan support".

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
index af396e4..7983be1 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
@@ -3299,8 +3299,8 @@ brcmf_notify_sched_scan_results(struct brcmf_cfg80211_priv *cfg_priv,
 		int i;
 
 		request = kzalloc(sizeof(*request), GFP_KERNEL);
-		ssid = kzalloc(sizeof(*ssid) * result_count, GFP_KERNEL);
-		channel = kzalloc(sizeof(*channel) * result_count, GFP_KERNEL);
+		ssid = kcalloc(result_count, sizeof(*ssid), GFP_KERNEL);
+		channel = kcalloc(result_count, sizeof(*channel), GFP_KERNEL);
 		if (!request || !ssid || !channel) {
 			err = -ENOMEM;
 			goto out_err;

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

end of thread, other threads:[~2012-09-27 10:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-26  7:21 [patch] brcmfmac: use kcalloc() to prevent integer overflow Dan Carpenter
2012-09-26  7:31 ` Dan Carpenter
2012-09-26  9:41   ` Arend van Spriel
2012-09-27 10:49 ` Arend van Spriel

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).