aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-08-11 03:02:48 -0400
committerDavid S. Miller <davem@davemloft.net>2010-08-17 20:45:14 -0400
commitbaeb2ffab4e67bb9174e6166e070a9a8ec94b0f6 (patch)
tree08259e966cc0cacc58ed58a4865fe861cc255241 /drivers/net
parent5a68d5ee000bb784c4856391b4861739c8bbd341 (diff)
drivers/net: Convert unbounded kzalloc calls to kcalloc
These changes may be slightly safer in some instances. There are other kzalloc calls with a multiply, but those calls are typically "small fixed #" * sizeof(some pointer)" and those are not converted. Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Gertjan van Wingerde <gwingerde@gmail.com> Acked-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/cnic.c2
-rw-r--r--drivers/net/ehea/ehea_main.c4
-rw-r--r--drivers/net/mlx4/alloc.c2
-rw-r--r--drivers/net/mlx4/en_rx.c2
-rw-r--r--drivers/net/mlx4/profile.c2
-rw-r--r--drivers/net/myri10ge/myri10ge.c4
-rw-r--r--drivers/net/niu.c4
-rw-r--r--drivers/net/vxge/vxge-main.c10
-rw-r--r--drivers/net/wireless/airo.c5
-rw-r--r--drivers/net/wireless/b43/phy_n.c2
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2100.c6
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2200.c12
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00debug.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c2
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_scan.c2
21 files changed, 37 insertions, 38 deletions
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index 09610323a948..2ab6a7c4ffc1 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -1022,7 +1022,7 @@ static int cnic_alloc_bnx2x_context(struct cnic_dev *dev)
1022 if (blks > cp->ethdev->ctx_tbl_len) 1022 if (blks > cp->ethdev->ctx_tbl_len)
1023 return -ENOMEM; 1023 return -ENOMEM;
1024 1024
1025 cp->ctx_arr = kzalloc(blks * sizeof(struct cnic_ctx), GFP_KERNEL); 1025 cp->ctx_arr = kcalloc(blks, sizeof(struct cnic_ctx), GFP_KERNEL);
1026 if (cp->ctx_arr == NULL) 1026 if (cp->ctx_arr == NULL)
1027 return -ENOMEM; 1027 return -ENOMEM;
1028 1028
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 897719b49f96..0f9b27b93a71 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -180,7 +180,7 @@ static void ehea_update_firmware_handles(void)
180 num_portres * EHEA_NUM_PORTRES_FW_HANDLES; 180 num_portres * EHEA_NUM_PORTRES_FW_HANDLES;
181 181
182 if (num_fw_handles) { 182 if (num_fw_handles) {
183 arr = kzalloc(num_fw_handles * sizeof(*arr), GFP_KERNEL); 183 arr = kcalloc(num_fw_handles, sizeof(*arr), GFP_KERNEL);
184 if (!arr) 184 if (!arr)
185 goto out; /* Keep the existing array */ 185 goto out; /* Keep the existing array */
186 } else 186 } else
@@ -265,7 +265,7 @@ static void ehea_update_bcmc_registrations(void)
265 } 265 }
266 266
267 if (num_registrations) { 267 if (num_registrations) {
268 arr = kzalloc(num_registrations * sizeof(*arr), GFP_ATOMIC); 268 arr = kcalloc(num_registrations, sizeof(*arr), GFP_ATOMIC);
269 if (!arr) 269 if (!arr)
270 goto out; /* Keep the existing array */ 270 goto out; /* Keep the existing array */
271 } else 271 } else
diff --git a/drivers/net/mlx4/alloc.c b/drivers/net/mlx4/alloc.c
index 8c8515619b8e..537997f9443e 100644
--- a/drivers/net/mlx4/alloc.c
+++ b/drivers/net/mlx4/alloc.c
@@ -188,7 +188,7 @@ int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct,
188 buf->nbufs = (size + PAGE_SIZE - 1) / PAGE_SIZE; 188 buf->nbufs = (size + PAGE_SIZE - 1) / PAGE_SIZE;
189 buf->npages = buf->nbufs; 189 buf->npages = buf->nbufs;
190 buf->page_shift = PAGE_SHIFT; 190 buf->page_shift = PAGE_SHIFT;
191 buf->page_list = kzalloc(buf->nbufs * sizeof *buf->page_list, 191 buf->page_list = kcalloc(buf->nbufs, sizeof(*buf->page_list),
192 GFP_KERNEL); 192 GFP_KERNEL);
193 if (!buf->page_list) 193 if (!buf->page_list)
194 return -ENOMEM; 194 return -ENOMEM;
diff --git a/drivers/net/mlx4/en_rx.c b/drivers/net/mlx4/en_rx.c
index 8e2fcb7103c3..efc3fad468db 100644
--- a/drivers/net/mlx4/en_rx.c
+++ b/drivers/net/mlx4/en_rx.c
@@ -322,7 +322,7 @@ int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv,
322 ring->lro.ip_summed_aggr = CHECKSUM_UNNECESSARY; 322 ring->lro.ip_summed_aggr = CHECKSUM_UNNECESSARY;
323 ring->lro.max_desc = mdev->profile.num_lro; 323 ring->lro.max_desc = mdev->profile.num_lro;
324 ring->lro.max_aggr = MAX_SKB_FRAGS; 324 ring->lro.max_aggr = MAX_SKB_FRAGS;
325 ring->lro.lro_arr = kzalloc(mdev->profile.num_lro * 325 ring->lro.lro_arr = kcalloc(mdev->profile.num_lro,
326 sizeof(struct net_lro_desc), 326 sizeof(struct net_lro_desc),
327 GFP_KERNEL); 327 GFP_KERNEL);
328 if (!ring->lro.lro_arr) { 328 if (!ring->lro.lro_arr) {
diff --git a/drivers/net/mlx4/profile.c b/drivers/net/mlx4/profile.c
index 5caf0115fa5b..e749f82865fe 100644
--- a/drivers/net/mlx4/profile.c
+++ b/drivers/net/mlx4/profile.c
@@ -85,7 +85,7 @@ u64 mlx4_make_profile(struct mlx4_dev *dev,
85 struct mlx4_resource tmp; 85 struct mlx4_resource tmp;
86 int i, j; 86 int i, j;
87 87
88 profile = kzalloc(MLX4_RES_NUM * sizeof *profile, GFP_KERNEL); 88 profile = kcalloc(MLX4_RES_NUM, sizeof(*profile), GFP_KERNEL);
89 if (!profile) 89 if (!profile)
90 return -ENOMEM; 90 return -ENOMEM;
91 91
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index fb2c0927d3cc..24ab8a43c777 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -3753,8 +3753,8 @@ static void myri10ge_probe_slices(struct myri10ge_priv *mgp)
3753 * slices. We give up on MSI-X if we can only get a single 3753 * slices. We give up on MSI-X if we can only get a single
3754 * vector. */ 3754 * vector. */
3755 3755
3756 mgp->msix_vectors = kzalloc(mgp->num_slices * 3756 mgp->msix_vectors = kcalloc(mgp->num_slices, sizeof(*mgp->msix_vectors),
3757 sizeof(*mgp->msix_vectors), GFP_KERNEL); 3757 GFP_KERNEL);
3758 if (mgp->msix_vectors == NULL) 3758 if (mgp->msix_vectors == NULL)
3759 goto disable_msix; 3759 goto disable_msix;
3760 for (i = 0; i < mgp->num_slices; i++) { 3760 for (i = 0; i < mgp->num_slices; i++) {
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index bc695d53cdcc..b4cc61f1fc59 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -4504,7 +4504,7 @@ static int niu_alloc_channels(struct niu *np)
4504 4504
4505 np->dev->real_num_tx_queues = np->num_tx_rings; 4505 np->dev->real_num_tx_queues = np->num_tx_rings;
4506 4506
4507 np->rx_rings = kzalloc(np->num_rx_rings * sizeof(struct rx_ring_info), 4507 np->rx_rings = kcalloc(np->num_rx_rings, sizeof(struct rx_ring_info),
4508 GFP_KERNEL); 4508 GFP_KERNEL);
4509 err = -ENOMEM; 4509 err = -ENOMEM;
4510 if (!np->rx_rings) 4510 if (!np->rx_rings)
@@ -4538,7 +4538,7 @@ static int niu_alloc_channels(struct niu *np)
4538 return err; 4538 return err;
4539 } 4539 }
4540 4540
4541 np->tx_rings = kzalloc(np->num_tx_rings * sizeof(struct tx_ring_info), 4541 np->tx_rings = kcalloc(np->num_tx_rings, sizeof(struct tx_ring_info),
4542 GFP_KERNEL); 4542 GFP_KERNEL);
4543 err = -ENOMEM; 4543 err = -ENOMEM;
4544 if (!np->tx_rings) 4544 if (!np->tx_rings)
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c
index c7c5605b3728..f5334b287fdb 100644
--- a/drivers/net/vxge/vxge-main.c
+++ b/drivers/net/vxge/vxge-main.c
@@ -2159,8 +2159,8 @@ start:
2159 /* Alarm MSIX Vectors count */ 2159 /* Alarm MSIX Vectors count */
2160 vdev->intr_cnt++; 2160 vdev->intr_cnt++;
2161 2161
2162 vdev->entries = kzalloc(vdev->intr_cnt * sizeof(struct msix_entry), 2162 vdev->entries = kcalloc(vdev->intr_cnt, sizeof(struct msix_entry),
2163 GFP_KERNEL); 2163 GFP_KERNEL);
2164 if (!vdev->entries) { 2164 if (!vdev->entries) {
2165 vxge_debug_init(VXGE_ERR, 2165 vxge_debug_init(VXGE_ERR,
2166 "%s: memory allocation failed", 2166 "%s: memory allocation failed",
@@ -2169,9 +2169,9 @@ start:
2169 goto alloc_entries_failed; 2169 goto alloc_entries_failed;
2170 } 2170 }
2171 2171
2172 vdev->vxge_entries = 2172 vdev->vxge_entries = kcalloc(vdev->intr_cnt,
2173 kzalloc(vdev->intr_cnt * sizeof(struct vxge_msix_entry), 2173 sizeof(struct vxge_msix_entry),
2174 GFP_KERNEL); 2174 GFP_KERNEL);
2175 if (!vdev->vxge_entries) { 2175 if (!vdev->vxge_entries) {
2176 vxge_debug_init(VXGE_ERR, "%s: memory allocation failed", 2176 vxge_debug_init(VXGE_ERR, "%s: memory allocation failed",
2177 VXGE_DRIVER_NAME); 2177 VXGE_DRIVER_NAME);
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 1d05445d4ba3..7d26506957d7 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -2723,9 +2723,8 @@ static int airo_networks_allocate(struct airo_info *ai)
2723 if (ai->networks) 2723 if (ai->networks)
2724 return 0; 2724 return 0;
2725 2725
2726 ai->networks = 2726 ai->networks = kcalloc(AIRO_MAX_NETWORK_COUNT, sizeof(BSSListElement),
2727 kzalloc(AIRO_MAX_NETWORK_COUNT * sizeof(BSSListElement), 2727 GFP_KERNEL);
2728 GFP_KERNEL);
2729 if (!ai->networks) { 2728 if (!ai->networks) {
2730 airo_print_warn("", "Out of memory allocating beacons"); 2729 airo_print_warn("", "Out of memory allocating beacons");
2731 return -ENOMEM; 2730 return -ENOMEM;
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 5a725703770c..e288c559481d 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -1182,7 +1182,7 @@ static u16 b43_nphy_gen_load_samples(struct b43_wldev *dev, u32 freq, u16 max,
1182 len = bw << 1; 1182 len = bw << 1;
1183 } 1183 }
1184 1184
1185 samples = kzalloc(len * sizeof(struct b43_c32), GFP_KERNEL); 1185 samples = kcalloc(len, sizeof(struct b43_c32), GFP_KERNEL);
1186 if (!samples) { 1186 if (!samples) {
1187 b43err(dev->wl, "allocation for samples generation failed\n"); 1187 b43err(dev->wl, "allocation for samples generation failed\n");
1188 return 0; 1188 return 0;
diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
index 1189dbb6e2a6..0c67b172d4c6 100644
--- a/drivers/net/wireless/ipw2x00/ipw2100.c
+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
@@ -1921,9 +1921,9 @@ static int ipw2100_net_init(struct net_device *dev)
1921 1921
1922 bg_band->band = IEEE80211_BAND_2GHZ; 1922 bg_band->band = IEEE80211_BAND_2GHZ;
1923 bg_band->n_channels = geo->bg_channels; 1923 bg_band->n_channels = geo->bg_channels;
1924 bg_band->channels = 1924 bg_band->channels = kcalloc(geo->bg_channels,
1925 kzalloc(geo->bg_channels * 1925 sizeof(struct ieee80211_channel),
1926 sizeof(struct ieee80211_channel), GFP_KERNEL); 1926 GFP_KERNEL);
1927 if (!bg_band->channels) { 1927 if (!bg_band->channels) {
1928 ipw2100_down(priv); 1928 ipw2100_down(priv);
1929 return -ENOMEM; 1929 return -ENOMEM;
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
index cb2552a6777c..0f2508384c75 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
@@ -11467,9 +11467,9 @@ static int ipw_net_init(struct net_device *dev)
11467 11467
11468 bg_band->band = IEEE80211_BAND_2GHZ; 11468 bg_band->band = IEEE80211_BAND_2GHZ;
11469 bg_band->n_channels = geo->bg_channels; 11469 bg_band->n_channels = geo->bg_channels;
11470 bg_band->channels = 11470 bg_band->channels = kcalloc(geo->bg_channels,
11471 kzalloc(geo->bg_channels * 11471 sizeof(struct ieee80211_channel),
11472 sizeof(struct ieee80211_channel), GFP_KERNEL); 11472 GFP_KERNEL);
11473 /* translate geo->bg to bg_band.channels */ 11473 /* translate geo->bg to bg_band.channels */
11474 for (i = 0; i < geo->bg_channels; i++) { 11474 for (i = 0; i < geo->bg_channels; i++) {
11475 bg_band->channels[i].band = IEEE80211_BAND_2GHZ; 11475 bg_band->channels[i].band = IEEE80211_BAND_2GHZ;
@@ -11502,9 +11502,9 @@ static int ipw_net_init(struct net_device *dev)
11502 11502
11503 a_band->band = IEEE80211_BAND_5GHZ; 11503 a_band->band = IEEE80211_BAND_5GHZ;
11504 a_band->n_channels = geo->a_channels; 11504 a_band->n_channels = geo->a_channels;
11505 a_band->channels = 11505 a_band->channels = kcalloc(geo->a_channels,
11506 kzalloc(geo->a_channels * 11506 sizeof(struct ieee80211_channel),
11507 sizeof(struct ieee80211_channel), GFP_KERNEL); 11507 GFP_KERNEL);
11508 /* translate geo->bg to a_band.channels */ 11508 /* translate geo->bg to a_band.channels */
11509 for (i = 0; i < geo->a_channels; i++) { 11509 for (i = 0; i < geo->a_channels; i++) {
11510 a_band->channels[i].band = IEEE80211_BAND_2GHZ; 11510 a_band->channels[i].band = IEEE80211_BAND_2GHZ;
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index 5063e01410e5..8e3fbdf48889 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -1481,7 +1481,7 @@ static int rt2400pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
1481 /* 1481 /*
1482 * Create channel information array 1482 * Create channel information array
1483 */ 1483 */
1484 info = kzalloc(spec->num_channels * sizeof(*info), GFP_KERNEL); 1484 info = kcalloc(spec->num_channels, sizeof(*info), GFP_KERNEL);
1485 if (!info) 1485 if (!info)
1486 return -ENOMEM; 1486 return -ENOMEM;
1487 1487
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index c2a555d5376b..1d174e42f11e 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -1795,7 +1795,7 @@ static int rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
1795 /* 1795 /*
1796 * Create channel information array 1796 * Create channel information array
1797 */ 1797 */
1798 info = kzalloc(spec->num_channels * sizeof(*info), GFP_KERNEL); 1798 info = kcalloc(spec->num_channels, sizeof(*info), GFP_KERNEL);
1799 if (!info) 1799 if (!info)
1800 return -ENOMEM; 1800 return -ENOMEM;
1801 1801
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index cdaf93f48263..8ddaae44d7fb 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -1698,7 +1698,7 @@ static int rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
1698 /* 1698 /*
1699 * Create channel information array 1699 * Create channel information array
1700 */ 1700 */
1701 info = kzalloc(spec->num_channels * sizeof(*info), GFP_KERNEL); 1701 info = kcalloc(spec->num_channels, sizeof(*info), GFP_KERNEL);
1702 if (!info) 1702 if (!info)
1703 return -ENOMEM; 1703 return -ENOMEM;
1704 1704
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index b66e0fd8f0fa..8c00fbda8664 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -2865,7 +2865,7 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2865 /* 2865 /*
2866 * Create channel information array 2866 * Create channel information array
2867 */ 2867 */
2868 info = kzalloc(spec->num_channels * sizeof(*info), GFP_KERNEL); 2868 info = kcalloc(spec->num_channels, sizeof(*info), GFP_KERNEL);
2869 if (!info) 2869 if (!info)
2870 return -ENOMEM; 2870 return -ENOMEM;
2871 2871
diff --git a/drivers/net/wireless/rt2x00/rt2x00debug.c b/drivers/net/wireless/rt2x00/rt2x00debug.c
index b0498e7e7aae..2d018ceffc54 100644
--- a/drivers/net/wireless/rt2x00/rt2x00debug.c
+++ b/drivers/net/wireless/rt2x00/rt2x00debug.c
@@ -333,7 +333,7 @@ static ssize_t rt2x00debug_read_queue_stats(struct file *file,
333 if (*offset) 333 if (*offset)
334 return 0; 334 return 0;
335 335
336 data = kzalloc(lines * MAX_LINE_LENGTH, GFP_KERNEL); 336 data = kcalloc(lines, MAX_LINE_LENGTH, GFP_KERNEL);
337 if (!data) 337 if (!data)
338 return -ENOMEM; 338 return -ENOMEM;
339 339
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index a3401d301058..9c609be95083 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -755,7 +755,7 @@ static int rt2x00queue_alloc_entries(struct data_queue *queue,
755 * Allocate all queue entries. 755 * Allocate all queue entries.
756 */ 756 */
757 entry_size = sizeof(*entries) + qdesc->priv_size; 757 entry_size = sizeof(*entries) + qdesc->priv_size;
758 entries = kzalloc(queue->limit * entry_size, GFP_KERNEL); 758 entries = kcalloc(queue->limit, entry_size, GFP_KERNEL);
759 if (!entries) 759 if (!entries)
760 return -ENOMEM; 760 return -ENOMEM;
761 761
@@ -891,7 +891,7 @@ int rt2x00queue_allocate(struct rt2x00_dev *rt2x00dev)
891 */ 891 */
892 rt2x00dev->data_queues = 2 + rt2x00dev->ops->tx_queues + req_atim; 892 rt2x00dev->data_queues = 2 + rt2x00dev->ops->tx_queues + req_atim;
893 893
894 queue = kzalloc(rt2x00dev->data_queues * sizeof(*queue), GFP_KERNEL); 894 queue = kcalloc(rt2x00dev->data_queues, sizeof(*queue), GFP_KERNEL);
895 if (!queue) { 895 if (!queue) {
896 ERROR(rt2x00dev, "Queue allocation failed.\n"); 896 ERROR(rt2x00dev, "Queue allocation failed.\n");
897 return -ENOMEM; 897 return -ENOMEM;
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index e539c6cb636f..f226582dbc87 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -2654,7 +2654,7 @@ static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2654 /* 2654 /*
2655 * Create channel information array 2655 * Create channel information array
2656 */ 2656 */
2657 info = kzalloc(spec->num_channels * sizeof(*info), GFP_KERNEL); 2657 info = kcalloc(spec->num_channels, sizeof(*info), GFP_KERNEL);
2658 if (!info) 2658 if (!info)
2659 return -ENOMEM; 2659 return -ENOMEM;
2660 2660
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index aa9de18fd410..99985a218653 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -2084,7 +2084,7 @@ static int rt73usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2084 /* 2084 /*
2085 * Create channel information array 2085 * Create channel information array
2086 */ 2086 */
2087 info = kzalloc(spec->num_channels * sizeof(*info), GFP_KERNEL); 2087 info = kcalloc(spec->num_channels, sizeof(*info), GFP_KERNEL);
2088 if (!info) 2088 if (!info)
2089 return -ENOMEM; 2089 return -ENOMEM;
2090 2090
diff --git a/drivers/net/wireless/wl12xx/wl1271_scan.c b/drivers/net/wireless/wl12xx/wl1271_scan.c
index fec43eed8c55..30dc1000f563 100644
--- a/drivers/net/wireless/wl12xx/wl1271_scan.c
+++ b/drivers/net/wireless/wl12xx/wl1271_scan.c
@@ -248,7 +248,7 @@ int wl1271_scan(struct wl1271 *wl, const u8 *ssid, size_t ssid_len,
248 248
249 wl->scan.req = req; 249 wl->scan.req = req;
250 250
251 wl->scan.scanned_ch = kzalloc(req->n_channels * 251 wl->scan.scanned_ch = kcalloc(req->n_channels,
252 sizeof(*wl->scan.scanned_ch), 252 sizeof(*wl->scan.scanned_ch),
253 GFP_KERNEL); 253 GFP_KERNEL);
254 wl1271_scan_stm(wl); 254 wl1271_scan_stm(wl);