diff options
Diffstat (limited to 'drivers/net')
64 files changed, 195 insertions, 163 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index bd53a71f6b00..63e3844c5bec 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -2418,7 +2418,7 @@ struct bond_vlan_tag *bond_verify_device_path(struct net_device *start_dev, | |||
2418 | struct list_head *iter; | 2418 | struct list_head *iter; |
2419 | 2419 | ||
2420 | if (start_dev == end_dev) { | 2420 | if (start_dev == end_dev) { |
2421 | tags = kzalloc(sizeof(*tags) * (level + 1), GFP_ATOMIC); | 2421 | tags = kcalloc(level + 1, sizeof(*tags), GFP_ATOMIC); |
2422 | if (!tags) | 2422 | if (!tags) |
2423 | return ERR_PTR(-ENOMEM); | 2423 | return ERR_PTR(-ENOMEM); |
2424 | tags[level].vlan_proto = VLAN_N_VID; | 2424 | tags[level].vlan_proto = VLAN_N_VID; |
diff --git a/drivers/net/can/grcan.c b/drivers/net/can/grcan.c index 2d3046afa80d..7eec1d9f86a0 100644 --- a/drivers/net/can/grcan.c +++ b/drivers/net/can/grcan.c | |||
@@ -1057,7 +1057,7 @@ static int grcan_open(struct net_device *dev) | |||
1057 | return err; | 1057 | return err; |
1058 | } | 1058 | } |
1059 | 1059 | ||
1060 | priv->echo_skb = kzalloc(dma->tx.size * sizeof(*priv->echo_skb), | 1060 | priv->echo_skb = kcalloc(dma->tx.size, sizeof(*priv->echo_skb), |
1061 | GFP_KERNEL); | 1061 | GFP_KERNEL); |
1062 | if (!priv->echo_skb) { | 1062 | if (!priv->echo_skb) { |
1063 | err = -ENOMEM; | 1063 | err = -ENOMEM; |
@@ -1066,7 +1066,7 @@ static int grcan_open(struct net_device *dev) | |||
1066 | priv->can.echo_skb_max = dma->tx.size; | 1066 | priv->can.echo_skb_max = dma->tx.size; |
1067 | priv->can.echo_skb = priv->echo_skb; | 1067 | priv->can.echo_skb = priv->echo_skb; |
1068 | 1068 | ||
1069 | priv->txdlc = kzalloc(dma->tx.size * sizeof(*priv->txdlc), GFP_KERNEL); | 1069 | priv->txdlc = kcalloc(dma->tx.size, sizeof(*priv->txdlc), GFP_KERNEL); |
1070 | if (!priv->txdlc) { | 1070 | if (!priv->txdlc) { |
1071 | err = -ENOMEM; | 1071 | err = -ENOMEM; |
1072 | goto exit_free_echo_skb; | 1072 | goto exit_free_echo_skb; |
diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c index 89d60d8e467c..aa97dbc797b6 100644 --- a/drivers/net/can/slcan.c +++ b/drivers/net/can/slcan.c | |||
@@ -703,7 +703,7 @@ static int __init slcan_init(void) | |||
703 | pr_info("slcan: serial line CAN interface driver\n"); | 703 | pr_info("slcan: serial line CAN interface driver\n"); |
704 | pr_info("slcan: %d dynamic interface channels.\n", maxdev); | 704 | pr_info("slcan: %d dynamic interface channels.\n", maxdev); |
705 | 705 | ||
706 | slcan_devs = kzalloc(sizeof(struct net_device *)*maxdev, GFP_KERNEL); | 706 | slcan_devs = kcalloc(maxdev, sizeof(struct net_device *), GFP_KERNEL); |
707 | if (!slcan_devs) | 707 | if (!slcan_devs) |
708 | return -ENOMEM; | 708 | return -ENOMEM; |
709 | 709 | ||
diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c index 14a59e51db67..897302adc38e 100644 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c | |||
@@ -2150,7 +2150,7 @@ static int bcm_enetsw_open(struct net_device *dev) | |||
2150 | priv->tx_desc_alloc_size = size; | 2150 | priv->tx_desc_alloc_size = size; |
2151 | priv->tx_desc_cpu = p; | 2151 | priv->tx_desc_cpu = p; |
2152 | 2152 | ||
2153 | priv->tx_skb = kzalloc(sizeof(struct sk_buff *) * priv->tx_ring_size, | 2153 | priv->tx_skb = kcalloc(priv->tx_ring_size, sizeof(struct sk_buff *), |
2154 | GFP_KERNEL); | 2154 | GFP_KERNEL); |
2155 | if (!priv->tx_skb) { | 2155 | if (!priv->tx_skb) { |
2156 | dev_err(kdev, "cannot allocate rx skb queue\n"); | 2156 | dev_err(kdev, "cannot allocate rx skb queue\n"); |
@@ -2164,7 +2164,7 @@ static int bcm_enetsw_open(struct net_device *dev) | |||
2164 | spin_lock_init(&priv->tx_lock); | 2164 | spin_lock_init(&priv->tx_lock); |
2165 | 2165 | ||
2166 | /* init & fill rx ring with skbs */ | 2166 | /* init & fill rx ring with skbs */ |
2167 | priv->rx_skb = kzalloc(sizeof(struct sk_buff *) * priv->rx_ring_size, | 2167 | priv->rx_skb = kcalloc(priv->rx_ring_size, sizeof(struct sk_buff *), |
2168 | GFP_KERNEL); | 2168 | GFP_KERNEL); |
2169 | if (!priv->rx_skb) { | 2169 | if (!priv->rx_skb) { |
2170 | dev_err(kdev, "cannot allocate rx skb queue\n"); | 2170 | dev_err(kdev, "cannot allocate rx skb queue\n"); |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c index ffa7959f6b31..dc77bfded865 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | |||
@@ -571,7 +571,7 @@ int bnx2x_vf_mcast(struct bnx2x *bp, struct bnx2x_virtf *vf, | |||
571 | else | 571 | else |
572 | set_bit(RAMROD_COMP_WAIT, &mcast.ramrod_flags); | 572 | set_bit(RAMROD_COMP_WAIT, &mcast.ramrod_flags); |
573 | if (mc_num) { | 573 | if (mc_num) { |
574 | mc = kzalloc(mc_num * sizeof(struct bnx2x_mcast_list_elem), | 574 | mc = kcalloc(mc_num, sizeof(struct bnx2x_mcast_list_elem), |
575 | GFP_KERNEL); | 575 | GFP_KERNEL); |
576 | if (!mc) { | 576 | if (!mc) { |
577 | BNX2X_ERR("Cannot Configure multicasts due to lack of memory\n"); | 577 | BNX2X_ERR("Cannot Configure multicasts due to lack of memory\n"); |
@@ -1253,8 +1253,9 @@ int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param, | |||
1253 | num_vfs_param, iov->nr_virtfn); | 1253 | num_vfs_param, iov->nr_virtfn); |
1254 | 1254 | ||
1255 | /* allocate the vf array */ | 1255 | /* allocate the vf array */ |
1256 | bp->vfdb->vfs = kzalloc(sizeof(struct bnx2x_virtf) * | 1256 | bp->vfdb->vfs = kcalloc(BNX2X_NR_VIRTFN(bp), |
1257 | BNX2X_NR_VIRTFN(bp), GFP_KERNEL); | 1257 | sizeof(struct bnx2x_virtf), |
1258 | GFP_KERNEL); | ||
1258 | if (!bp->vfdb->vfs) { | 1259 | if (!bp->vfdb->vfs) { |
1259 | BNX2X_ERR("failed to allocate vf array\n"); | 1260 | BNX2X_ERR("failed to allocate vf array\n"); |
1260 | err = -ENOMEM; | 1261 | err = -ENOMEM; |
@@ -1278,9 +1279,9 @@ int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param, | |||
1278 | } | 1279 | } |
1279 | 1280 | ||
1280 | /* allocate the queue arrays for all VFs */ | 1281 | /* allocate the queue arrays for all VFs */ |
1281 | bp->vfdb->vfqs = kzalloc( | 1282 | bp->vfdb->vfqs = kcalloc(BNX2X_MAX_NUM_VF_QUEUES, |
1282 | BNX2X_MAX_NUM_VF_QUEUES * sizeof(struct bnx2x_vf_queue), | 1283 | sizeof(struct bnx2x_vf_queue), |
1283 | GFP_KERNEL); | 1284 | GFP_KERNEL); |
1284 | 1285 | ||
1285 | if (!bp->vfdb->vfqs) { | 1286 | if (!bp->vfdb->vfqs) { |
1286 | BNX2X_ERR("failed to allocate vf queue array\n"); | 1287 | BNX2X_ERR("failed to allocate vf queue array\n"); |
diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c index 8bc126a156e8..30273a7717e2 100644 --- a/drivers/net/ethernet/broadcom/cnic.c +++ b/drivers/net/ethernet/broadcom/cnic.c | |||
@@ -660,7 +660,7 @@ static int cnic_init_id_tbl(struct cnic_id_tbl *id_tbl, u32 size, u32 start_id, | |||
660 | id_tbl->max = size; | 660 | id_tbl->max = size; |
661 | id_tbl->next = next; | 661 | id_tbl->next = next; |
662 | spin_lock_init(&id_tbl->lock); | 662 | spin_lock_init(&id_tbl->lock); |
663 | id_tbl->table = kzalloc(DIV_ROUND_UP(size, 32) * 4, GFP_KERNEL); | 663 | id_tbl->table = kcalloc(DIV_ROUND_UP(size, 32), 4, GFP_KERNEL); |
664 | if (!id_tbl->table) | 664 | if (!id_tbl->table) |
665 | return -ENOMEM; | 665 | return -ENOMEM; |
666 | 666 | ||
@@ -1255,13 +1255,13 @@ static int cnic_alloc_bnx2x_resc(struct cnic_dev *dev) | |||
1255 | cp->fcoe_init_cid = 0x10; | 1255 | cp->fcoe_init_cid = 0x10; |
1256 | } | 1256 | } |
1257 | 1257 | ||
1258 | cp->iscsi_tbl = kzalloc(sizeof(struct cnic_iscsi) * MAX_ISCSI_TBL_SZ, | 1258 | cp->iscsi_tbl = kcalloc(MAX_ISCSI_TBL_SZ, sizeof(struct cnic_iscsi), |
1259 | GFP_KERNEL); | 1259 | GFP_KERNEL); |
1260 | if (!cp->iscsi_tbl) | 1260 | if (!cp->iscsi_tbl) |
1261 | goto error; | 1261 | goto error; |
1262 | 1262 | ||
1263 | cp->ctx_tbl = kzalloc(sizeof(struct cnic_context) * | 1263 | cp->ctx_tbl = kcalloc(cp->max_cid_space, sizeof(struct cnic_context), |
1264 | cp->max_cid_space, GFP_KERNEL); | 1264 | GFP_KERNEL); |
1265 | if (!cp->ctx_tbl) | 1265 | if (!cp->ctx_tbl) |
1266 | goto error; | 1266 | goto error; |
1267 | 1267 | ||
@@ -4100,7 +4100,7 @@ static int cnic_cm_alloc_mem(struct cnic_dev *dev) | |||
4100 | struct cnic_local *cp = dev->cnic_priv; | 4100 | struct cnic_local *cp = dev->cnic_priv; |
4101 | u32 port_id; | 4101 | u32 port_id; |
4102 | 4102 | ||
4103 | cp->csk_tbl = kzalloc(sizeof(struct cnic_sock) * MAX_CM_SK_TBL_SZ, | 4103 | cp->csk_tbl = kcalloc(MAX_CM_SK_TBL_SZ, sizeof(struct cnic_sock), |
4104 | GFP_KERNEL); | 4104 | GFP_KERNEL); |
4105 | if (!cp->csk_tbl) | 4105 | if (!cp->csk_tbl) |
4106 | return -ENOMEM; | 4106 | return -ENOMEM; |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 9f59b1270a7c..3be87efdc93d 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -8631,8 +8631,9 @@ static int tg3_mem_tx_acquire(struct tg3 *tp) | |||
8631 | tnapi++; | 8631 | tnapi++; |
8632 | 8632 | ||
8633 | for (i = 0; i < tp->txq_cnt; i++, tnapi++) { | 8633 | for (i = 0; i < tp->txq_cnt; i++, tnapi++) { |
8634 | tnapi->tx_buffers = kzalloc(sizeof(struct tg3_tx_ring_info) * | 8634 | tnapi->tx_buffers = kcalloc(TG3_TX_RING_SIZE, |
8635 | TG3_TX_RING_SIZE, GFP_KERNEL); | 8635 | sizeof(struct tg3_tx_ring_info), |
8636 | GFP_KERNEL); | ||
8636 | if (!tnapi->tx_buffers) | 8637 | if (!tnapi->tx_buffers) |
8637 | goto err_out; | 8638 | goto err_out; |
8638 | 8639 | ||
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index 69cc3e0119d6..ea5f32ea308a 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c | |||
@@ -3141,7 +3141,7 @@ bnad_set_rx_ucast_fltr(struct bnad *bnad) | |||
3141 | if (uc_count > bna_attr(&bnad->bna)->num_ucmac) | 3141 | if (uc_count > bna_attr(&bnad->bna)->num_ucmac) |
3142 | goto mode_default; | 3142 | goto mode_default; |
3143 | 3143 | ||
3144 | mac_list = kzalloc(uc_count * ETH_ALEN, GFP_ATOMIC); | 3144 | mac_list = kcalloc(ETH_ALEN, uc_count, GFP_ATOMIC); |
3145 | if (mac_list == NULL) | 3145 | if (mac_list == NULL) |
3146 | goto mode_default; | 3146 | goto mode_default; |
3147 | 3147 | ||
@@ -3182,7 +3182,7 @@ bnad_set_rx_mcast_fltr(struct bnad *bnad) | |||
3182 | if (mc_count > bna_attr(&bnad->bna)->num_mcmac) | 3182 | if (mc_count > bna_attr(&bnad->bna)->num_mcmac) |
3183 | goto mode_allmulti; | 3183 | goto mode_allmulti; |
3184 | 3184 | ||
3185 | mac_list = kzalloc((mc_count + 1) * ETH_ALEN, GFP_ATOMIC); | 3185 | mac_list = kcalloc(mc_count + 1, ETH_ALEN, GFP_ATOMIC); |
3186 | 3186 | ||
3187 | if (mac_list == NULL) | 3187 | if (mac_list == NULL) |
3188 | goto mode_allmulti; | 3188 | goto mode_allmulti; |
diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c index 2bd7c638b178..2c63afff1382 100644 --- a/drivers/net/ethernet/calxeda/xgmac.c +++ b/drivers/net/ethernet/calxeda/xgmac.c | |||
@@ -739,7 +739,7 @@ static int xgmac_dma_desc_rings_init(struct net_device *dev) | |||
739 | 739 | ||
740 | netdev_dbg(priv->dev, "mtu [%d] bfsize [%d]\n", dev->mtu, bfsize); | 740 | netdev_dbg(priv->dev, "mtu [%d] bfsize [%d]\n", dev->mtu, bfsize); |
741 | 741 | ||
742 | priv->rx_skbuff = kzalloc(sizeof(struct sk_buff *) * DMA_RX_RING_SZ, | 742 | priv->rx_skbuff = kcalloc(DMA_RX_RING_SZ, sizeof(struct sk_buff *), |
743 | GFP_KERNEL); | 743 | GFP_KERNEL); |
744 | if (!priv->rx_skbuff) | 744 | if (!priv->rx_skbuff) |
745 | return -ENOMEM; | 745 | return -ENOMEM; |
@@ -752,7 +752,7 @@ static int xgmac_dma_desc_rings_init(struct net_device *dev) | |||
752 | if (!priv->dma_rx) | 752 | if (!priv->dma_rx) |
753 | goto err_dma_rx; | 753 | goto err_dma_rx; |
754 | 754 | ||
755 | priv->tx_skbuff = kzalloc(sizeof(struct sk_buff *) * DMA_TX_RING_SZ, | 755 | priv->tx_skbuff = kcalloc(DMA_TX_RING_SZ, sizeof(struct sk_buff *), |
756 | GFP_KERNEL); | 756 | GFP_KERNEL); |
757 | if (!priv->tx_skbuff) | 757 | if (!priv->tx_skbuff) |
758 | goto err_tx_skb; | 758 | goto err_tx_skb; |
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c index d42704d07484..187a249ff2d1 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c | |||
@@ -292,8 +292,8 @@ static int nicvf_init_rbdr(struct nicvf *nic, struct rbdr *rbdr, | |||
292 | rbdr->is_xdp = true; | 292 | rbdr->is_xdp = true; |
293 | } | 293 | } |
294 | rbdr->pgcnt = roundup_pow_of_two(rbdr->pgcnt); | 294 | rbdr->pgcnt = roundup_pow_of_two(rbdr->pgcnt); |
295 | rbdr->pgcache = kzalloc(sizeof(*rbdr->pgcache) * | 295 | rbdr->pgcache = kcalloc(rbdr->pgcnt, sizeof(*rbdr->pgcache), |
296 | rbdr->pgcnt, GFP_KERNEL); | 296 | GFP_KERNEL); |
297 | if (!rbdr->pgcache) | 297 | if (!rbdr->pgcache) |
298 | return -ENOMEM; | 298 | return -ENOMEM; |
299 | rbdr->pgidx = 0; | 299 | rbdr->pgidx = 0; |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c index a95cde0fadf7..4bc211093c98 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c | |||
@@ -561,13 +561,13 @@ int t4_uld_mem_alloc(struct adapter *adap) | |||
561 | if (!adap->uld) | 561 | if (!adap->uld) |
562 | return -ENOMEM; | 562 | return -ENOMEM; |
563 | 563 | ||
564 | s->uld_rxq_info = kzalloc(CXGB4_ULD_MAX * | 564 | s->uld_rxq_info = kcalloc(CXGB4_ULD_MAX, |
565 | sizeof(struct sge_uld_rxq_info *), | 565 | sizeof(struct sge_uld_rxq_info *), |
566 | GFP_KERNEL); | 566 | GFP_KERNEL); |
567 | if (!s->uld_rxq_info) | 567 | if (!s->uld_rxq_info) |
568 | goto err_uld; | 568 | goto err_uld; |
569 | 569 | ||
570 | s->uld_txq_info = kzalloc(CXGB4_TX_MAX * | 570 | s->uld_txq_info = kcalloc(CXGB4_TX_MAX, |
571 | sizeof(struct sge_uld_txq_info *), | 571 | sizeof(struct sge_uld_txq_info *), |
572 | GFP_KERNEL); | 572 | GFP_KERNEL); |
573 | if (!s->uld_txq_info) | 573 | if (!s->uld_txq_info) |
diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c index ff9eb45f67f8..6d7404f66f84 100644 --- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c | |||
@@ -910,8 +910,8 @@ static int geth_setup_freeq(struct gemini_ethernet *geth) | |||
910 | } | 910 | } |
911 | 911 | ||
912 | /* Allocate a mapping to page look-up index */ | 912 | /* Allocate a mapping to page look-up index */ |
913 | geth->freeq_pages = kzalloc(pages * sizeof(*geth->freeq_pages), | 913 | geth->freeq_pages = kcalloc(pages, sizeof(*geth->freeq_pages), |
914 | GFP_KERNEL); | 914 | GFP_KERNEL); |
915 | if (!geth->freeq_pages) | 915 | if (!geth->freeq_pages) |
916 | goto err_freeq; | 916 | goto err_freeq; |
917 | geth->num_freeq_pages = pages; | 917 | geth->num_freeq_pages = pages; |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c index 1ccb6443d2ed..ef9ef703d13a 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c | |||
@@ -2197,7 +2197,8 @@ static int hns_nic_init_ring_data(struct hns_nic_priv *priv) | |||
2197 | return -EINVAL; | 2197 | return -EINVAL; |
2198 | } | 2198 | } |
2199 | 2199 | ||
2200 | priv->ring_data = kzalloc(h->q_num * sizeof(*priv->ring_data) * 2, | 2200 | priv->ring_data = kzalloc(array3_size(h->q_num, |
2201 | sizeof(*priv->ring_data), 2), | ||
2201 | GFP_KERNEL); | 2202 | GFP_KERNEL); |
2202 | if (!priv->ring_data) | 2203 | if (!priv->ring_data) |
2203 | return -ENOMEM; | 2204 | return -ENOMEM; |
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index acf1e8b52b8e..3ba0c90e7055 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | |||
@@ -3312,7 +3312,7 @@ static int e1000e_write_mc_addr_list(struct net_device *netdev) | |||
3312 | return 0; | 3312 | return 0; |
3313 | } | 3313 | } |
3314 | 3314 | ||
3315 | mta_list = kzalloc(netdev_mc_count(netdev) * ETH_ALEN, GFP_ATOMIC); | 3315 | mta_list = kcalloc(netdev_mc_count(netdev), ETH_ALEN, GFP_ATOMIC); |
3316 | if (!mta_list) | 3316 | if (!mta_list) |
3317 | return -ENOMEM; | 3317 | return -ENOMEM; |
3318 | 3318 | ||
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index c33821d2afb3..f707709969ac 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -3763,8 +3763,9 @@ static int igb_sw_init(struct igb_adapter *adapter) | |||
3763 | /* Assume MSI-X interrupts, will be checked during IRQ allocation */ | 3763 | /* Assume MSI-X interrupts, will be checked during IRQ allocation */ |
3764 | adapter->flags |= IGB_FLAG_HAS_MSIX; | 3764 | adapter->flags |= IGB_FLAG_HAS_MSIX; |
3765 | 3765 | ||
3766 | adapter->mac_table = kzalloc(sizeof(struct igb_mac_addr) * | 3766 | adapter->mac_table = kcalloc(hw->mac.rar_entry_count, |
3767 | hw->mac.rar_entry_count, GFP_ATOMIC); | 3767 | sizeof(struct igb_mac_addr), |
3768 | GFP_ATOMIC); | ||
3768 | if (!adapter->mac_table) | 3769 | if (!adapter->mac_table) |
3769 | return -ENOMEM; | 3770 | return -ENOMEM; |
3770 | 3771 | ||
@@ -4752,7 +4753,7 @@ static int igb_write_mc_addr_list(struct net_device *netdev) | |||
4752 | return 0; | 4753 | return 0; |
4753 | } | 4754 | } |
4754 | 4755 | ||
4755 | mta_list = kzalloc(netdev_mc_count(netdev) * 6, GFP_ATOMIC); | 4756 | mta_list = kcalloc(netdev_mc_count(netdev), 6, GFP_ATOMIC); |
4756 | if (!mta_list) | 4757 | if (!mta_list) |
4757 | return -ENOMEM; | 4758 | return -ENOMEM; |
4758 | 4759 | ||
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 4929f7265598..0b1ba3ae159c 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -6034,8 +6034,8 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter, | |||
6034 | for (i = 1; i < IXGBE_MAX_LINK_HANDLE; i++) | 6034 | for (i = 1; i < IXGBE_MAX_LINK_HANDLE; i++) |
6035 | adapter->jump_tables[i] = NULL; | 6035 | adapter->jump_tables[i] = NULL; |
6036 | 6036 | ||
6037 | adapter->mac_table = kzalloc(sizeof(struct ixgbe_mac_addr) * | 6037 | adapter->mac_table = kcalloc(hw->mac.num_rar_entries, |
6038 | hw->mac.num_rar_entries, | 6038 | sizeof(struct ixgbe_mac_addr), |
6039 | GFP_ATOMIC); | 6039 | GFP_ATOMIC); |
6040 | if (!adapter->mac_table) | 6040 | if (!adapter->mac_table) |
6041 | return -ENOMEM; | 6041 | return -ENOMEM; |
diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c index 8a165842fa85..06ff185eb188 100644 --- a/drivers/net/ethernet/jme.c +++ b/drivers/net/ethernet/jme.c | |||
@@ -589,8 +589,9 @@ jme_setup_tx_resources(struct jme_adapter *jme) | |||
589 | atomic_set(&txring->next_to_clean, 0); | 589 | atomic_set(&txring->next_to_clean, 0); |
590 | atomic_set(&txring->nr_free, jme->tx_ring_size); | 590 | atomic_set(&txring->nr_free, jme->tx_ring_size); |
591 | 591 | ||
592 | txring->bufinf = kzalloc(sizeof(struct jme_buffer_info) * | 592 | txring->bufinf = kcalloc(jme->tx_ring_size, |
593 | jme->tx_ring_size, GFP_ATOMIC); | 593 | sizeof(struct jme_buffer_info), |
594 | GFP_ATOMIC); | ||
594 | if (unlikely(!(txring->bufinf))) | 595 | if (unlikely(!(txring->bufinf))) |
595 | goto err_free_txring; | 596 | goto err_free_txring; |
596 | 597 | ||
@@ -838,8 +839,9 @@ jme_setup_rx_resources(struct jme_adapter *jme) | |||
838 | rxring->next_to_use = 0; | 839 | rxring->next_to_use = 0; |
839 | atomic_set(&rxring->next_to_clean, 0); | 840 | atomic_set(&rxring->next_to_clean, 0); |
840 | 841 | ||
841 | rxring->bufinf = kzalloc(sizeof(struct jme_buffer_info) * | 842 | rxring->bufinf = kcalloc(jme->rx_ring_size, |
842 | jme->rx_ring_size, GFP_ATOMIC); | 843 | sizeof(struct jme_buffer_info), |
844 | GFP_ATOMIC); | ||
843 | if (unlikely(!(rxring->bufinf))) | 845 | if (unlikely(!(rxring->bufinf))) |
844 | goto err_free_rxring; | 846 | goto err_free_rxring; |
845 | 847 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/alloc.c b/drivers/net/ethernet/mellanox/mlx4/alloc.c index 6dabd983e7e0..4bdf25059542 100644 --- a/drivers/net/ethernet/mellanox/mlx4/alloc.c +++ b/drivers/net/ethernet/mellanox/mlx4/alloc.c | |||
@@ -185,8 +185,8 @@ int mlx4_bitmap_init(struct mlx4_bitmap *bitmap, u32 num, u32 mask, | |||
185 | bitmap->avail = num - reserved_top - reserved_bot; | 185 | bitmap->avail = num - reserved_top - reserved_bot; |
186 | bitmap->effective_len = bitmap->avail; | 186 | bitmap->effective_len = bitmap->avail; |
187 | spin_lock_init(&bitmap->lock); | 187 | spin_lock_init(&bitmap->lock); |
188 | bitmap->table = kzalloc(BITS_TO_LONGS(bitmap->max) * | 188 | bitmap->table = kcalloc(BITS_TO_LONGS(bitmap->max), sizeof(long), |
189 | sizeof(long), GFP_KERNEL); | 189 | GFP_KERNEL); |
190 | if (!bitmap->table) | 190 | if (!bitmap->table) |
191 | return -ENOMEM; | 191 | return -ENOMEM; |
192 | 192 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c index 03375c705df7..e65bc3c95630 100644 --- a/drivers/net/ethernet/mellanox/mlx4/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c | |||
@@ -2377,20 +2377,23 @@ int mlx4_multi_func_init(struct mlx4_dev *dev) | |||
2377 | struct mlx4_vf_admin_state *vf_admin; | 2377 | struct mlx4_vf_admin_state *vf_admin; |
2378 | 2378 | ||
2379 | priv->mfunc.master.slave_state = | 2379 | priv->mfunc.master.slave_state = |
2380 | kzalloc(dev->num_slaves * | 2380 | kcalloc(dev->num_slaves, |
2381 | sizeof(struct mlx4_slave_state), GFP_KERNEL); | 2381 | sizeof(struct mlx4_slave_state), |
2382 | GFP_KERNEL); | ||
2382 | if (!priv->mfunc.master.slave_state) | 2383 | if (!priv->mfunc.master.slave_state) |
2383 | goto err_comm; | 2384 | goto err_comm; |
2384 | 2385 | ||
2385 | priv->mfunc.master.vf_admin = | 2386 | priv->mfunc.master.vf_admin = |
2386 | kzalloc(dev->num_slaves * | 2387 | kcalloc(dev->num_slaves, |
2387 | sizeof(struct mlx4_vf_admin_state), GFP_KERNEL); | 2388 | sizeof(struct mlx4_vf_admin_state), |
2389 | GFP_KERNEL); | ||
2388 | if (!priv->mfunc.master.vf_admin) | 2390 | if (!priv->mfunc.master.vf_admin) |
2389 | goto err_comm_admin; | 2391 | goto err_comm_admin; |
2390 | 2392 | ||
2391 | priv->mfunc.master.vf_oper = | 2393 | priv->mfunc.master.vf_oper = |
2392 | kzalloc(dev->num_slaves * | 2394 | kcalloc(dev->num_slaves, |
2393 | sizeof(struct mlx4_vf_oper_state), GFP_KERNEL); | 2395 | sizeof(struct mlx4_vf_oper_state), |
2396 | GFP_KERNEL); | ||
2394 | if (!priv->mfunc.master.vf_oper) | 2397 | if (!priv->mfunc.master.vf_oper) |
2395 | goto err_comm_oper; | 2398 | goto err_comm_oper; |
2396 | 2399 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 9670b33fc9b1..65eb06e017e4 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -2229,13 +2229,15 @@ static int mlx4_en_copy_priv(struct mlx4_en_priv *dst, | |||
2229 | if (!dst->tx_ring_num[t]) | 2229 | if (!dst->tx_ring_num[t]) |
2230 | continue; | 2230 | continue; |
2231 | 2231 | ||
2232 | dst->tx_ring[t] = kzalloc(sizeof(struct mlx4_en_tx_ring *) * | 2232 | dst->tx_ring[t] = kcalloc(MAX_TX_RINGS, |
2233 | MAX_TX_RINGS, GFP_KERNEL); | 2233 | sizeof(struct mlx4_en_tx_ring *), |
2234 | GFP_KERNEL); | ||
2234 | if (!dst->tx_ring[t]) | 2235 | if (!dst->tx_ring[t]) |
2235 | goto err_free_tx; | 2236 | goto err_free_tx; |
2236 | 2237 | ||
2237 | dst->tx_cq[t] = kzalloc(sizeof(struct mlx4_en_cq *) * | 2238 | dst->tx_cq[t] = kcalloc(MAX_TX_RINGS, |
2238 | MAX_TX_RINGS, GFP_KERNEL); | 2239 | sizeof(struct mlx4_en_cq *), |
2240 | GFP_KERNEL); | ||
2239 | if (!dst->tx_cq[t]) { | 2241 | if (!dst->tx_cq[t]) { |
2240 | kfree(dst->tx_ring[t]); | 2242 | kfree(dst->tx_ring[t]); |
2241 | goto err_free_tx; | 2243 | goto err_free_tx; |
@@ -3320,14 +3322,16 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
3320 | if (!priv->tx_ring_num[t]) | 3322 | if (!priv->tx_ring_num[t]) |
3321 | continue; | 3323 | continue; |
3322 | 3324 | ||
3323 | priv->tx_ring[t] = kzalloc(sizeof(struct mlx4_en_tx_ring *) * | 3325 | priv->tx_ring[t] = kcalloc(MAX_TX_RINGS, |
3324 | MAX_TX_RINGS, GFP_KERNEL); | 3326 | sizeof(struct mlx4_en_tx_ring *), |
3327 | GFP_KERNEL); | ||
3325 | if (!priv->tx_ring[t]) { | 3328 | if (!priv->tx_ring[t]) { |
3326 | err = -ENOMEM; | 3329 | err = -ENOMEM; |
3327 | goto out; | 3330 | goto out; |
3328 | } | 3331 | } |
3329 | priv->tx_cq[t] = kzalloc(sizeof(struct mlx4_en_cq *) * | 3332 | priv->tx_cq[t] = kcalloc(MAX_TX_RINGS, |
3330 | MAX_TX_RINGS, GFP_KERNEL); | 3333 | sizeof(struct mlx4_en_cq *), |
3334 | GFP_KERNEL); | ||
3331 | if (!priv->tx_cq[t]) { | 3335 | if (!priv->tx_cq[t]) { |
3332 | err = -ENOMEM; | 3336 | err = -ENOMEM; |
3333 | goto out; | 3337 | goto out; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 0a30d81aab3b..872014702fc1 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -2982,7 +2982,8 @@ static int mlx4_init_steering(struct mlx4_dev *dev) | |||
2982 | int num_entries = dev->caps.num_ports; | 2982 | int num_entries = dev->caps.num_ports; |
2983 | int i, j; | 2983 | int i, j; |
2984 | 2984 | ||
2985 | priv->steer = kzalloc(sizeof(struct mlx4_steer) * num_entries, GFP_KERNEL); | 2985 | priv->steer = kcalloc(num_entries, sizeof(struct mlx4_steer), |
2986 | GFP_KERNEL); | ||
2986 | if (!priv->steer) | 2987 | if (!priv->steer) |
2987 | return -ENOMEM; | 2988 | return -ENOMEM; |
2988 | 2989 | ||
@@ -3103,7 +3104,7 @@ static u64 mlx4_enable_sriov(struct mlx4_dev *dev, struct pci_dev *pdev, | |||
3103 | } | 3104 | } |
3104 | } | 3105 | } |
3105 | 3106 | ||
3106 | dev->dev_vfs = kzalloc(total_vfs * sizeof(*dev->dev_vfs), GFP_KERNEL); | 3107 | dev->dev_vfs = kcalloc(total_vfs, sizeof(*dev->dev_vfs), GFP_KERNEL); |
3107 | if (NULL == dev->dev_vfs) { | 3108 | if (NULL == dev->dev_vfs) { |
3108 | mlx4_err(dev, "Failed to allocate memory for VFs\n"); | 3109 | mlx4_err(dev, "Failed to allocate memory for VFs\n"); |
3109 | goto disable_sriov; | 3110 | goto disable_sriov; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index b0e11255a355..7b1b5ac986d0 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | |||
@@ -487,7 +487,7 @@ int mlx4_init_resource_tracker(struct mlx4_dev *dev) | |||
487 | int max_vfs_guarantee_counter = get_max_gauranteed_vfs_counter(dev); | 487 | int max_vfs_guarantee_counter = get_max_gauranteed_vfs_counter(dev); |
488 | 488 | ||
489 | priv->mfunc.master.res_tracker.slave_list = | 489 | priv->mfunc.master.res_tracker.slave_list = |
490 | kzalloc(dev->num_slaves * sizeof(struct slave_list), | 490 | kcalloc(dev->num_slaves, sizeof(struct slave_list), |
491 | GFP_KERNEL); | 491 | GFP_KERNEL); |
492 | if (!priv->mfunc.master.res_tracker.slave_list) | 492 | if (!priv->mfunc.master.res_tracker.slave_list) |
493 | return -ENOMEM; | 493 | return -ENOMEM; |
@@ -514,14 +514,14 @@ int mlx4_init_resource_tracker(struct mlx4_dev *dev) | |||
514 | sizeof(int), | 514 | sizeof(int), |
515 | GFP_KERNEL); | 515 | GFP_KERNEL); |
516 | if (i == RES_MAC || i == RES_VLAN) | 516 | if (i == RES_MAC || i == RES_VLAN) |
517 | res_alloc->allocated = kzalloc(MLX4_MAX_PORTS * | 517 | res_alloc->allocated = |
518 | (dev->persist->num_vfs | 518 | kcalloc(MLX4_MAX_PORTS * |
519 | + 1) * | 519 | (dev->persist->num_vfs + 1), |
520 | sizeof(int), GFP_KERNEL); | 520 | sizeof(int), GFP_KERNEL); |
521 | else | 521 | else |
522 | res_alloc->allocated = kzalloc((dev->persist-> | 522 | res_alloc->allocated = |
523 | num_vfs + 1) * | 523 | kcalloc(dev->persist->num_vfs + 1, |
524 | sizeof(int), GFP_KERNEL); | 524 | sizeof(int), GFP_KERNEL); |
525 | /* Reduce the sink counter */ | 525 | /* Reduce the sink counter */ |
526 | if (i == RES_COUNTER) | 526 | if (i == RES_COUNTER) |
527 | res_alloc->res_free = dev->caps.max_counters - 1; | 527 | res_alloc->res_free = dev->caps.max_counters - 1; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c b/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c index a0433b48e833..5645a4facad2 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c | |||
@@ -381,7 +381,7 @@ int mlx5_fpga_ipsec_counters_read(struct mlx5_core_dev *mdev, u64 *counters, | |||
381 | 381 | ||
382 | count = mlx5_fpga_ipsec_counters_count(mdev); | 382 | count = mlx5_fpga_ipsec_counters_count(mdev); |
383 | 383 | ||
384 | data = kzalloc(sizeof(*data) * count * 2, GFP_KERNEL); | 384 | data = kzalloc(array3_size(sizeof(*data), count, 2), GFP_KERNEL); |
385 | if (!data) { | 385 | if (!data) { |
386 | ret = -ENOMEM; | 386 | ret = -ENOMEM; |
387 | goto out; | 387 | goto out; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c index 857035583ccd..1e062e6b2587 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c | |||
@@ -394,8 +394,9 @@ static int mlx5_init_pin_config(struct mlx5_clock *clock) | |||
394 | int i; | 394 | int i; |
395 | 395 | ||
396 | clock->ptp_info.pin_config = | 396 | clock->ptp_info.pin_config = |
397 | kzalloc(sizeof(*clock->ptp_info.pin_config) * | 397 | kcalloc(clock->ptp_info.n_pins, |
398 | clock->ptp_info.n_pins, GFP_KERNEL); | 398 | sizeof(*clock->ptp_info.pin_config), |
399 | GFP_KERNEL); | ||
399 | if (!clock->ptp_info.pin_config) | 400 | if (!clock->ptp_info.pin_config) |
400 | return -ENOMEM; | 401 | return -ENOMEM; |
401 | clock->ptp_info.enable = mlx5_ptp_enable; | 402 | clock->ptp_info.enable = mlx5_ptp_enable; |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c index 91262b0573e3..cad603c35271 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c | |||
@@ -740,7 +740,8 @@ int mlxsw_sp_tc_qdisc_init(struct mlxsw_sp_port *mlxsw_sp_port) | |||
740 | mlxsw_sp_port->root_qdisc->prio_bitmap = 0xff; | 740 | mlxsw_sp_port->root_qdisc->prio_bitmap = 0xff; |
741 | mlxsw_sp_port->root_qdisc->tclass_num = MLXSW_SP_PORT_DEFAULT_TCLASS; | 741 | mlxsw_sp_port->root_qdisc->tclass_num = MLXSW_SP_PORT_DEFAULT_TCLASS; |
742 | 742 | ||
743 | mlxsw_sp_qdisc = kzalloc(sizeof(*mlxsw_sp_qdisc) * IEEE_8021QAZ_MAX_TCS, | 743 | mlxsw_sp_qdisc = kcalloc(IEEE_8021QAZ_MAX_TCS, |
744 | sizeof(*mlxsw_sp_qdisc), | ||
744 | GFP_KERNEL); | 745 | GFP_KERNEL); |
745 | if (!mlxsw_sp_qdisc) | 746 | if (!mlxsw_sp_qdisc) |
746 | goto err_tclass_qdiscs_init; | 747 | goto err_tclass_qdiscs_init; |
diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c index 52207508744c..b72d1bd11296 100644 --- a/drivers/net/ethernet/micrel/ksz884x.c +++ b/drivers/net/ethernet/micrel/ksz884x.c | |||
@@ -4372,7 +4372,7 @@ static void ksz_update_timer(struct ksz_timer_info *info) | |||
4372 | */ | 4372 | */ |
4373 | static int ksz_alloc_soft_desc(struct ksz_desc_info *desc_info, int transmit) | 4373 | static int ksz_alloc_soft_desc(struct ksz_desc_info *desc_info, int transmit) |
4374 | { | 4374 | { |
4375 | desc_info->ring = kzalloc(sizeof(struct ksz_desc) * desc_info->alloc, | 4375 | desc_info->ring = kcalloc(desc_info->alloc, sizeof(struct ksz_desc), |
4376 | GFP_KERNEL); | 4376 | GFP_KERNEL); |
4377 | if (!desc_info->ring) | 4377 | if (!desc_info->ring) |
4378 | return 1; | 4378 | return 1; |
diff --git a/drivers/net/ethernet/neterion/vxge/vxge-config.c b/drivers/net/ethernet/neterion/vxge/vxge-config.c index c60da9e8bf14..8d0295655933 100644 --- a/drivers/net/ethernet/neterion/vxge/vxge-config.c +++ b/drivers/net/ethernet/neterion/vxge/vxge-config.c | |||
@@ -2220,22 +2220,22 @@ __vxge_hw_channel_allocate(struct __vxge_hw_vpath_handle *vph, | |||
2220 | channel->length = length; | 2220 | channel->length = length; |
2221 | channel->vp_id = vp_id; | 2221 | channel->vp_id = vp_id; |
2222 | 2222 | ||
2223 | channel->work_arr = kzalloc(sizeof(void *)*length, GFP_KERNEL); | 2223 | channel->work_arr = kcalloc(length, sizeof(void *), GFP_KERNEL); |
2224 | if (channel->work_arr == NULL) | 2224 | if (channel->work_arr == NULL) |
2225 | goto exit1; | 2225 | goto exit1; |
2226 | 2226 | ||
2227 | channel->free_arr = kzalloc(sizeof(void *)*length, GFP_KERNEL); | 2227 | channel->free_arr = kcalloc(length, sizeof(void *), GFP_KERNEL); |
2228 | if (channel->free_arr == NULL) | 2228 | if (channel->free_arr == NULL) |
2229 | goto exit1; | 2229 | goto exit1; |
2230 | channel->free_ptr = length; | 2230 | channel->free_ptr = length; |
2231 | 2231 | ||
2232 | channel->reserve_arr = kzalloc(sizeof(void *)*length, GFP_KERNEL); | 2232 | channel->reserve_arr = kcalloc(length, sizeof(void *), GFP_KERNEL); |
2233 | if (channel->reserve_arr == NULL) | 2233 | if (channel->reserve_arr == NULL) |
2234 | goto exit1; | 2234 | goto exit1; |
2235 | channel->reserve_ptr = length; | 2235 | channel->reserve_ptr = length; |
2236 | channel->reserve_top = 0; | 2236 | channel->reserve_top = 0; |
2237 | 2237 | ||
2238 | channel->orig_arr = kzalloc(sizeof(void *)*length, GFP_KERNEL); | 2238 | channel->orig_arr = kcalloc(length, sizeof(void *), GFP_KERNEL); |
2239 | if (channel->orig_arr == NULL) | 2239 | if (channel->orig_arr == NULL) |
2240 | goto exit1; | 2240 | goto exit1; |
2241 | 2241 | ||
diff --git a/drivers/net/ethernet/neterion/vxge/vxge-main.c b/drivers/net/ethernet/neterion/vxge/vxge-main.c index a8918bb7c802..5ae3fa82909f 100644 --- a/drivers/net/ethernet/neterion/vxge/vxge-main.c +++ b/drivers/net/ethernet/neterion/vxge/vxge-main.c | |||
@@ -3429,8 +3429,8 @@ static int vxge_device_register(struct __vxge_hw_device *hldev, | |||
3429 | vxge_initialize_ethtool_ops(ndev); | 3429 | vxge_initialize_ethtool_ops(ndev); |
3430 | 3430 | ||
3431 | /* Allocate memory for vpath */ | 3431 | /* Allocate memory for vpath */ |
3432 | vdev->vpaths = kzalloc((sizeof(struct vxge_vpath)) * | 3432 | vdev->vpaths = kcalloc(no_of_vpath, sizeof(struct vxge_vpath), |
3433 | no_of_vpath, GFP_KERNEL); | 3433 | GFP_KERNEL); |
3434 | if (!vdev->vpaths) { | 3434 | if (!vdev->vpaths) { |
3435 | vxge_debug_init(VXGE_ERR, | 3435 | vxge_debug_init(VXGE_ERR, |
3436 | "%s: vpath memory allocation failed", | 3436 | "%s: vpath memory allocation failed", |
diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.c b/drivers/net/ethernet/pasemi/pasemi_mac.c index 07a2eb3781b1..8a31a02c9f47 100644 --- a/drivers/net/ethernet/pasemi/pasemi_mac.c +++ b/drivers/net/ethernet/pasemi/pasemi_mac.c | |||
@@ -390,8 +390,9 @@ static int pasemi_mac_setup_rx_resources(const struct net_device *dev) | |||
390 | spin_lock_init(&ring->lock); | 390 | spin_lock_init(&ring->lock); |
391 | 391 | ||
392 | ring->size = RX_RING_SIZE; | 392 | ring->size = RX_RING_SIZE; |
393 | ring->ring_info = kzalloc(sizeof(struct pasemi_mac_buffer) * | 393 | ring->ring_info = kcalloc(RX_RING_SIZE, |
394 | RX_RING_SIZE, GFP_KERNEL); | 394 | sizeof(struct pasemi_mac_buffer), |
395 | GFP_KERNEL); | ||
395 | 396 | ||
396 | if (!ring->ring_info) | 397 | if (!ring->ring_info) |
397 | goto out_ring_info; | 398 | goto out_ring_info; |
@@ -473,8 +474,9 @@ pasemi_mac_setup_tx_resources(const struct net_device *dev) | |||
473 | spin_lock_init(&ring->lock); | 474 | spin_lock_init(&ring->lock); |
474 | 475 | ||
475 | ring->size = TX_RING_SIZE; | 476 | ring->size = TX_RING_SIZE; |
476 | ring->ring_info = kzalloc(sizeof(struct pasemi_mac_buffer) * | 477 | ring->ring_info = kcalloc(TX_RING_SIZE, |
477 | TX_RING_SIZE, GFP_KERNEL); | 478 | sizeof(struct pasemi_mac_buffer), |
479 | GFP_KERNEL); | ||
478 | if (!ring->ring_info) | 480 | if (!ring->ring_info) |
479 | goto out_ring_info; | 481 | goto out_ring_info; |
480 | 482 | ||
diff --git a/drivers/net/ethernet/qlogic/qed/qed_debug.c b/drivers/net/ethernet/qlogic/qed/qed_debug.c index b9ec460dd996..a14e48489029 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_debug.c +++ b/drivers/net/ethernet/qlogic/qed/qed_debug.c | |||
@@ -6617,7 +6617,8 @@ static enum dbg_status qed_mcp_trace_alloc_meta(struct qed_hwfn *p_hwfn, | |||
6617 | 6617 | ||
6618 | /* Read no. of modules and allocate memory for their pointers */ | 6618 | /* Read no. of modules and allocate memory for their pointers */ |
6619 | meta->modules_num = qed_read_byte_from_buf(meta_buf_bytes, &offset); | 6619 | meta->modules_num = qed_read_byte_from_buf(meta_buf_bytes, &offset); |
6620 | meta->modules = kzalloc(meta->modules_num * sizeof(char *), GFP_KERNEL); | 6620 | meta->modules = kcalloc(meta->modules_num, sizeof(char *), |
6621 | GFP_KERNEL); | ||
6621 | if (!meta->modules) | 6622 | if (!meta->modules) |
6622 | return DBG_STATUS_VIRT_MEM_ALLOC_FAILED; | 6623 | return DBG_STATUS_VIRT_MEM_ALLOC_FAILED; |
6623 | 6624 | ||
@@ -6645,7 +6646,7 @@ static enum dbg_status qed_mcp_trace_alloc_meta(struct qed_hwfn *p_hwfn, | |||
6645 | 6646 | ||
6646 | /* Read number of formats and allocate memory for all formats */ | 6647 | /* Read number of formats and allocate memory for all formats */ |
6647 | meta->formats_num = qed_read_dword_from_buf(meta_buf_bytes, &offset); | 6648 | meta->formats_num = qed_read_dword_from_buf(meta_buf_bytes, &offset); |
6648 | meta->formats = kzalloc(meta->formats_num * | 6649 | meta->formats = kcalloc(meta->formats_num, |
6649 | sizeof(struct mcp_trace_format), | 6650 | sizeof(struct mcp_trace_format), |
6650 | GFP_KERNEL); | 6651 | GFP_KERNEL); |
6651 | if (!meta->formats) | 6652 | if (!meta->formats) |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c b/drivers/net/ethernet/qlogic/qed/qed_dev.c index b285edc8d6a1..329781cda77f 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_dev.c +++ b/drivers/net/ethernet/qlogic/qed/qed_dev.c | |||
@@ -814,26 +814,26 @@ static int qed_alloc_qm_data(struct qed_hwfn *p_hwfn) | |||
814 | if (rc) | 814 | if (rc) |
815 | goto alloc_err; | 815 | goto alloc_err; |
816 | 816 | ||
817 | qm_info->qm_pq_params = kzalloc(sizeof(*qm_info->qm_pq_params) * | 817 | qm_info->qm_pq_params = kcalloc(qed_init_qm_get_num_pqs(p_hwfn), |
818 | qed_init_qm_get_num_pqs(p_hwfn), | 818 | sizeof(*qm_info->qm_pq_params), |
819 | GFP_KERNEL); | 819 | GFP_KERNEL); |
820 | if (!qm_info->qm_pq_params) | 820 | if (!qm_info->qm_pq_params) |
821 | goto alloc_err; | 821 | goto alloc_err; |
822 | 822 | ||
823 | qm_info->qm_vport_params = kzalloc(sizeof(*qm_info->qm_vport_params) * | 823 | qm_info->qm_vport_params = kcalloc(qed_init_qm_get_num_vports(p_hwfn), |
824 | qed_init_qm_get_num_vports(p_hwfn), | 824 | sizeof(*qm_info->qm_vport_params), |
825 | GFP_KERNEL); | 825 | GFP_KERNEL); |
826 | if (!qm_info->qm_vport_params) | 826 | if (!qm_info->qm_vport_params) |
827 | goto alloc_err; | 827 | goto alloc_err; |
828 | 828 | ||
829 | qm_info->qm_port_params = kzalloc(sizeof(*qm_info->qm_port_params) * | 829 | qm_info->qm_port_params = kcalloc(p_hwfn->cdev->num_ports_in_engine, |
830 | p_hwfn->cdev->num_ports_in_engine, | 830 | sizeof(*qm_info->qm_port_params), |
831 | GFP_KERNEL); | 831 | GFP_KERNEL); |
832 | if (!qm_info->qm_port_params) | 832 | if (!qm_info->qm_port_params) |
833 | goto alloc_err; | 833 | goto alloc_err; |
834 | 834 | ||
835 | qm_info->wfq_data = kzalloc(sizeof(*qm_info->wfq_data) * | 835 | qm_info->wfq_data = kcalloc(qed_init_qm_get_num_vports(p_hwfn), |
836 | qed_init_qm_get_num_vports(p_hwfn), | 836 | sizeof(*qm_info->wfq_data), |
837 | GFP_KERNEL); | 837 | GFP_KERNEL); |
838 | if (!qm_info->wfq_data) | 838 | if (!qm_info->wfq_data) |
839 | goto alloc_err; | 839 | goto alloc_err; |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_init_ops.c b/drivers/net/ethernet/qlogic/qed/qed_init_ops.c index 3bb76da6baa2..d9ab5add27a8 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_init_ops.c +++ b/drivers/net/ethernet/qlogic/qed/qed_init_ops.c | |||
@@ -149,12 +149,12 @@ int qed_init_alloc(struct qed_hwfn *p_hwfn) | |||
149 | if (IS_VF(p_hwfn->cdev)) | 149 | if (IS_VF(p_hwfn->cdev)) |
150 | return 0; | 150 | return 0; |
151 | 151 | ||
152 | rt_data->b_valid = kzalloc(sizeof(bool) * RUNTIME_ARRAY_SIZE, | 152 | rt_data->b_valid = kcalloc(RUNTIME_ARRAY_SIZE, sizeof(bool), |
153 | GFP_KERNEL); | 153 | GFP_KERNEL); |
154 | if (!rt_data->b_valid) | 154 | if (!rt_data->b_valid) |
155 | return -ENOMEM; | 155 | return -ENOMEM; |
156 | 156 | ||
157 | rt_data->init_val = kzalloc(sizeof(u32) * RUNTIME_ARRAY_SIZE, | 157 | rt_data->init_val = kcalloc(RUNTIME_ARRAY_SIZE, sizeof(u32), |
158 | GFP_KERNEL); | 158 | GFP_KERNEL); |
159 | if (!rt_data->init_val) { | 159 | if (!rt_data->init_val) { |
160 | kfree(rt_data->b_valid); | 160 | kfree(rt_data->b_valid); |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_l2.c b/drivers/net/ethernet/qlogic/qed/qed_l2.c index 1f6ac848109d..de1c70843efd 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_l2.c +++ b/drivers/net/ethernet/qlogic/qed/qed_l2.c | |||
@@ -98,7 +98,7 @@ int qed_l2_alloc(struct qed_hwfn *p_hwfn) | |||
98 | p_l2_info->queues = max_t(u8, rx, tx); | 98 | p_l2_info->queues = max_t(u8, rx, tx); |
99 | } | 99 | } |
100 | 100 | ||
101 | pp_qids = kzalloc(sizeof(unsigned long *) * p_l2_info->queues, | 101 | pp_qids = kcalloc(p_l2_info->queues, sizeof(unsigned long *), |
102 | GFP_KERNEL); | 102 | GFP_KERNEL); |
103 | if (!pp_qids) | 103 | if (!pp_qids) |
104 | return -ENOMEM; | 104 | return -ENOMEM; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index 1b5f7d57b6f8..8c6724063231 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
@@ -1025,15 +1025,17 @@ int qlcnic_init_pci_info(struct qlcnic_adapter *adapter) | |||
1025 | 1025 | ||
1026 | act_pci_func = ahw->total_nic_func; | 1026 | act_pci_func = ahw->total_nic_func; |
1027 | 1027 | ||
1028 | adapter->npars = kzalloc(sizeof(struct qlcnic_npar_info) * | 1028 | adapter->npars = kcalloc(act_pci_func, |
1029 | act_pci_func, GFP_KERNEL); | 1029 | sizeof(struct qlcnic_npar_info), |
1030 | GFP_KERNEL); | ||
1030 | if (!adapter->npars) { | 1031 | if (!adapter->npars) { |
1031 | ret = -ENOMEM; | 1032 | ret = -ENOMEM; |
1032 | goto err_pci_info; | 1033 | goto err_pci_info; |
1033 | } | 1034 | } |
1034 | 1035 | ||
1035 | adapter->eswitch = kzalloc(sizeof(struct qlcnic_eswitch) * | 1036 | adapter->eswitch = kcalloc(QLCNIC_NIU_MAX_XG_PORTS, |
1036 | QLCNIC_NIU_MAX_XG_PORTS, GFP_KERNEL); | 1037 | sizeof(struct qlcnic_eswitch), |
1038 | GFP_KERNEL); | ||
1037 | if (!adapter->eswitch) { | 1039 | if (!adapter->eswitch) { |
1038 | ret = -ENOMEM; | 1040 | ret = -ENOMEM; |
1039 | goto err_npars; | 1041 | goto err_npars; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c index c58180f40844..0c744b9c6e0a 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c | |||
@@ -157,8 +157,8 @@ int qlcnic_sriov_init(struct qlcnic_adapter *adapter, int num_vfs) | |||
157 | adapter->ahw->sriov = sriov; | 157 | adapter->ahw->sriov = sriov; |
158 | sriov->num_vfs = num_vfs; | 158 | sriov->num_vfs = num_vfs; |
159 | bc = &sriov->bc; | 159 | bc = &sriov->bc; |
160 | sriov->vf_info = kzalloc(sizeof(struct qlcnic_vf_info) * | 160 | sriov->vf_info = kcalloc(num_vfs, sizeof(struct qlcnic_vf_info), |
161 | num_vfs, GFP_KERNEL); | 161 | GFP_KERNEL); |
162 | if (!sriov->vf_info) { | 162 | if (!sriov->vf_info) { |
163 | err = -ENOMEM; | 163 | err = -ENOMEM; |
164 | goto qlcnic_free_sriov; | 164 | goto qlcnic_free_sriov; |
@@ -450,7 +450,7 @@ static int qlcnic_sriov_set_guest_vlan_mode(struct qlcnic_adapter *adapter, | |||
450 | return 0; | 450 | return 0; |
451 | 451 | ||
452 | num_vlans = sriov->num_allowed_vlans; | 452 | num_vlans = sriov->num_allowed_vlans; |
453 | sriov->allowed_vlans = kzalloc(sizeof(u16) * num_vlans, GFP_KERNEL); | 453 | sriov->allowed_vlans = kcalloc(num_vlans, sizeof(u16), GFP_KERNEL); |
454 | if (!sriov->allowed_vlans) | 454 | if (!sriov->allowed_vlans) |
455 | return -ENOMEM; | 455 | return -ENOMEM; |
456 | 456 | ||
@@ -706,7 +706,7 @@ static inline int qlcnic_sriov_alloc_bc_trans(struct qlcnic_bc_trans **trans) | |||
706 | static inline int qlcnic_sriov_alloc_bc_msg(struct qlcnic_bc_hdr **hdr, | 706 | static inline int qlcnic_sriov_alloc_bc_msg(struct qlcnic_bc_hdr **hdr, |
707 | u32 size) | 707 | u32 size) |
708 | { | 708 | { |
709 | *hdr = kzalloc(sizeof(struct qlcnic_bc_hdr) * size, GFP_ATOMIC); | 709 | *hdr = kcalloc(size, sizeof(struct qlcnic_bc_hdr), GFP_ATOMIC); |
710 | if (!*hdr) | 710 | if (!*hdr) |
711 | return -ENOMEM; | 711 | return -ENOMEM; |
712 | 712 | ||
diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c index ce8071fc90c4..e080d3e7c582 100644 --- a/drivers/net/ethernet/socionext/netsec.c +++ b/drivers/net/ethernet/socionext/netsec.c | |||
@@ -973,7 +973,7 @@ static int netsec_alloc_dring(struct netsec_priv *priv, enum ring_id id) | |||
973 | goto err; | 973 | goto err; |
974 | } | 974 | } |
975 | 975 | ||
976 | dring->desc = kzalloc(DESC_NUM * sizeof(*dring->desc), GFP_KERNEL); | 976 | dring->desc = kcalloc(DESC_NUM, sizeof(*dring->desc), GFP_KERNEL); |
977 | if (!dring->desc) { | 977 | if (!dring->desc) { |
978 | ret = -ENOMEM; | 978 | ret = -ENOMEM; |
979 | goto err; | 979 | goto err; |
diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c b/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c index eed18f88bdff..302079e22b06 100644 --- a/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c +++ b/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c | |||
@@ -2320,8 +2320,9 @@ static struct net_device *gelic_wl_alloc(struct gelic_card *card) | |||
2320 | pr_debug("%s: wl=%p port=%p\n", __func__, wl, port); | 2320 | pr_debug("%s: wl=%p port=%p\n", __func__, wl, port); |
2321 | 2321 | ||
2322 | /* allocate scan list */ | 2322 | /* allocate scan list */ |
2323 | wl->networks = kzalloc(sizeof(struct gelic_wl_scan_info) * | 2323 | wl->networks = kcalloc(GELIC_WL_BSS_MAX_ENT, |
2324 | GELIC_WL_BSS_MAX_ENT, GFP_KERNEL); | 2324 | sizeof(struct gelic_wl_scan_info), |
2325 | GFP_KERNEL); | ||
2325 | 2326 | ||
2326 | if (!wl->networks) | 2327 | if (!wl->networks) |
2327 | goto fail_bss; | 2328 | goto fail_bss; |
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c index a6c87793d899..79e9b103188b 100644 --- a/drivers/net/phy/dp83640.c +++ b/drivers/net/phy/dp83640.c | |||
@@ -1097,8 +1097,9 @@ static struct dp83640_clock *dp83640_clock_get_bus(struct mii_bus *bus) | |||
1097 | if (!clock) | 1097 | if (!clock) |
1098 | goto out; | 1098 | goto out; |
1099 | 1099 | ||
1100 | clock->caps.pin_config = kzalloc(sizeof(struct ptp_pin_desc) * | 1100 | clock->caps.pin_config = kcalloc(DP83640_N_PINS, |
1101 | DP83640_N_PINS, GFP_KERNEL); | 1101 | sizeof(struct ptp_pin_desc), |
1102 | GFP_KERNEL); | ||
1102 | if (!clock->caps.pin_config) { | 1103 | if (!clock->caps.pin_config) { |
1103 | kfree(clock); | 1104 | kfree(clock); |
1104 | clock = NULL; | 1105 | clock = NULL; |
diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c index 8940417c30e5..b008266e91ea 100644 --- a/drivers/net/slip/slip.c +++ b/drivers/net/slip/slip.c | |||
@@ -1307,7 +1307,7 @@ static int __init slip_init(void) | |||
1307 | printk(KERN_INFO "SLIP linefill/keepalive option.\n"); | 1307 | printk(KERN_INFO "SLIP linefill/keepalive option.\n"); |
1308 | #endif | 1308 | #endif |
1309 | 1309 | ||
1310 | slip_devs = kzalloc(sizeof(struct net_device *)*slip_maxdev, | 1310 | slip_devs = kcalloc(slip_maxdev, sizeof(struct net_device *), |
1311 | GFP_KERNEL); | 1311 | GFP_KERNEL); |
1312 | if (!slip_devs) | 1312 | if (!slip_devs) |
1313 | return -ENOMEM; | 1313 | return -ENOMEM; |
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index ca0af0e15a2c..b070959737ff 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c | |||
@@ -280,7 +280,7 @@ static int __team_options_register(struct team *team, | |||
280 | struct team_option **dst_opts; | 280 | struct team_option **dst_opts; |
281 | int err; | 281 | int err; |
282 | 282 | ||
283 | dst_opts = kzalloc(sizeof(struct team_option *) * option_count, | 283 | dst_opts = kcalloc(option_count, sizeof(struct team_option *), |
284 | GFP_KERNEL); | 284 | GFP_KERNEL); |
285 | if (!dst_opts) | 285 | if (!dst_opts) |
286 | return -ENOMEM; | 286 | return -ENOMEM; |
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 309b88acd3d0..06b4d290784d 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c | |||
@@ -1661,7 +1661,7 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message) | |||
1661 | } | 1661 | } |
1662 | 1662 | ||
1663 | if (pdata->wolopts & (WAKE_BCAST | WAKE_MCAST | WAKE_ARP | WAKE_UCAST)) { | 1663 | if (pdata->wolopts & (WAKE_BCAST | WAKE_MCAST | WAKE_ARP | WAKE_UCAST)) { |
1664 | u32 *filter_mask = kzalloc(sizeof(u32) * 32, GFP_KERNEL); | 1664 | u32 *filter_mask = kcalloc(32, sizeof(u32), GFP_KERNEL); |
1665 | u32 command[2]; | 1665 | u32 command[2]; |
1666 | u32 offset[2]; | 1666 | u32 offset[2]; |
1667 | u32 crc[4]; | 1667 | u32 crc[4]; |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 15b9a83bbd9d..b6c9a2af3732 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -2552,7 +2552,7 @@ static int virtnet_find_vqs(struct virtnet_info *vi) | |||
2552 | virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ); | 2552 | virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ); |
2553 | 2553 | ||
2554 | /* Allocate space for find_vqs parameters */ | 2554 | /* Allocate space for find_vqs parameters */ |
2555 | vqs = kzalloc(total_vqs * sizeof(*vqs), GFP_KERNEL); | 2555 | vqs = kcalloc(total_vqs, sizeof(*vqs), GFP_KERNEL); |
2556 | if (!vqs) | 2556 | if (!vqs) |
2557 | goto err_vq; | 2557 | goto err_vq; |
2558 | callbacks = kmalloc_array(total_vqs, sizeof(*callbacks), GFP_KERNEL); | 2558 | callbacks = kmalloc_array(total_vqs, sizeof(*callbacks), GFP_KERNEL); |
@@ -2562,7 +2562,7 @@ static int virtnet_find_vqs(struct virtnet_info *vi) | |||
2562 | if (!names) | 2562 | if (!names) |
2563 | goto err_names; | 2563 | goto err_names; |
2564 | if (!vi->big_packets || vi->mergeable_rx_bufs) { | 2564 | if (!vi->big_packets || vi->mergeable_rx_bufs) { |
2565 | ctx = kzalloc(total_vqs * sizeof(*ctx), GFP_KERNEL); | 2565 | ctx = kcalloc(total_vqs, sizeof(*ctx), GFP_KERNEL); |
2566 | if (!ctx) | 2566 | if (!ctx) |
2567 | goto err_ctx; | 2567 | goto err_ctx; |
2568 | } else { | 2568 | } else { |
@@ -2626,10 +2626,10 @@ static int virtnet_alloc_queues(struct virtnet_info *vi) | |||
2626 | vi->ctrl = kzalloc(sizeof(*vi->ctrl), GFP_KERNEL); | 2626 | vi->ctrl = kzalloc(sizeof(*vi->ctrl), GFP_KERNEL); |
2627 | if (!vi->ctrl) | 2627 | if (!vi->ctrl) |
2628 | goto err_ctrl; | 2628 | goto err_ctrl; |
2629 | vi->sq = kzalloc(sizeof(*vi->sq) * vi->max_queue_pairs, GFP_KERNEL); | 2629 | vi->sq = kcalloc(vi->max_queue_pairs, sizeof(*vi->sq), GFP_KERNEL); |
2630 | if (!vi->sq) | 2630 | if (!vi->sq) |
2631 | goto err_sq; | 2631 | goto err_sq; |
2632 | vi->rq = kzalloc(sizeof(*vi->rq) * vi->max_queue_pairs, GFP_KERNEL); | 2632 | vi->rq = kcalloc(vi->max_queue_pairs, sizeof(*vi->rq), GFP_KERNEL); |
2633 | if (!vi->rq) | 2633 | if (!vi->rq) |
2634 | goto err_rq; | 2634 | goto err_rq; |
2635 | 2635 | ||
diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c index 4205dfd19da3..9b09c9d0d0fb 100644 --- a/drivers/net/wan/fsl_ucc_hdlc.c +++ b/drivers/net/wan/fsl_ucc_hdlc.c | |||
@@ -198,12 +198,14 @@ static int uhdlc_init(struct ucc_hdlc_private *priv) | |||
198 | goto free_tx_bd; | 198 | goto free_tx_bd; |
199 | } | 199 | } |
200 | 200 | ||
201 | priv->rx_skbuff = kzalloc(priv->rx_ring_size * sizeof(*priv->rx_skbuff), | 201 | priv->rx_skbuff = kcalloc(priv->rx_ring_size, |
202 | sizeof(*priv->rx_skbuff), | ||
202 | GFP_KERNEL); | 203 | GFP_KERNEL); |
203 | if (!priv->rx_skbuff) | 204 | if (!priv->rx_skbuff) |
204 | goto free_ucc_pram; | 205 | goto free_ucc_pram; |
205 | 206 | ||
206 | priv->tx_skbuff = kzalloc(priv->tx_ring_size * sizeof(*priv->tx_skbuff), | 207 | priv->tx_skbuff = kcalloc(priv->tx_ring_size, |
208 | sizeof(*priv->tx_skbuff), | ||
207 | GFP_KERNEL); | 209 | GFP_KERNEL); |
208 | if (!priv->tx_skbuff) | 210 | if (!priv->tx_skbuff) |
209 | goto free_rx_skbuff; | 211 | goto free_rx_skbuff; |
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index bd23f6940488..c72d8af122a2 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c | |||
@@ -582,7 +582,7 @@ int ath10k_htt_rx_alloc(struct ath10k_htt *htt) | |||
582 | } | 582 | } |
583 | 583 | ||
584 | htt->rx_ring.netbufs_ring = | 584 | htt->rx_ring.netbufs_ring = |
585 | kzalloc(htt->rx_ring.size * sizeof(struct sk_buff *), | 585 | kcalloc(htt->rx_ring.size, sizeof(struct sk_buff *), |
586 | GFP_KERNEL); | 586 | GFP_KERNEL); |
587 | if (!htt->rx_ring.netbufs_ring) | 587 | if (!htt->rx_ring.netbufs_ring) |
588 | goto err_netbuf; | 588 | goto err_netbuf; |
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c index 2e34a1fc5ba6..8c49a26fc571 100644 --- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c | |||
@@ -155,7 +155,7 @@ ath10k_wmi_tlv_parse_alloc(struct ath10k *ar, const void *ptr, | |||
155 | const void **tb; | 155 | const void **tb; |
156 | int ret; | 156 | int ret; |
157 | 157 | ||
158 | tb = kzalloc(sizeof(*tb) * WMI_TLV_TAG_MAX, gfp); | 158 | tb = kcalloc(WMI_TLV_TAG_MAX, sizeof(*tb), gfp); |
159 | if (!tb) | 159 | if (!tb) |
160 | return ERR_PTR(-ENOMEM); | 160 | return ERR_PTR(-ENOMEM); |
161 | 161 | ||
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c index 2ba8cf3f38af..0687697d5e2d 100644 --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c | |||
@@ -1041,7 +1041,7 @@ static int ath6kl_cfg80211_scan(struct wiphy *wiphy, | |||
1041 | 1041 | ||
1042 | n_channels = request->n_channels; | 1042 | n_channels = request->n_channels; |
1043 | 1043 | ||
1044 | channels = kzalloc(n_channels * sizeof(u16), GFP_KERNEL); | 1044 | channels = kcalloc(n_channels, sizeof(u16), GFP_KERNEL); |
1045 | if (channels == NULL) { | 1045 | if (channels == NULL) { |
1046 | ath6kl_warn("failed to set scan channels, scan all channels"); | 1046 | ath6kl_warn("failed to set scan channels, scan all channels"); |
1047 | n_channels = 0; | 1047 | n_channels = 0; |
diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c index 29e93c953d93..7f1bdea742b8 100644 --- a/drivers/net/wireless/ath/carl9170/main.c +++ b/drivers/net/wireless/ath/carl9170/main.c | |||
@@ -1958,7 +1958,7 @@ static int carl9170_parse_eeprom(struct ar9170 *ar) | |||
1958 | if (!bands) | 1958 | if (!bands) |
1959 | return -EINVAL; | 1959 | return -EINVAL; |
1960 | 1960 | ||
1961 | ar->survey = kzalloc(sizeof(struct survey_info) * chans, GFP_KERNEL); | 1961 | ar->survey = kcalloc(chans, sizeof(struct survey_info), GFP_KERNEL); |
1962 | if (!ar->survey) | 1962 | if (!ar->survey) |
1963 | return -ENOMEM; | 1963 | return -ENOMEM; |
1964 | ar->num_channels = chans; | 1964 | ar->num_channels = chans; |
@@ -1988,8 +1988,9 @@ int carl9170_register(struct ar9170 *ar) | |||
1988 | if (WARN_ON(ar->mem_bitmap)) | 1988 | if (WARN_ON(ar->mem_bitmap)) |
1989 | return -EINVAL; | 1989 | return -EINVAL; |
1990 | 1990 | ||
1991 | ar->mem_bitmap = kzalloc(roundup(ar->fw.mem_blocks, BITS_PER_LONG) * | 1991 | ar->mem_bitmap = kcalloc(roundup(ar->fw.mem_blocks, BITS_PER_LONG), |
1992 | sizeof(unsigned long), GFP_KERNEL); | 1992 | sizeof(unsigned long), |
1993 | GFP_KERNEL); | ||
1993 | 1994 | ||
1994 | if (!ar->mem_bitmap) | 1995 | if (!ar->mem_bitmap) |
1995 | return -ENOMEM; | 1996 | return -ENOMEM; |
diff --git a/drivers/net/wireless/broadcom/b43/phy_n.c b/drivers/net/wireless/broadcom/b43/phy_n.c index f2a2f41e3c96..44ab080d6518 100644 --- a/drivers/net/wireless/broadcom/b43/phy_n.c +++ b/drivers/net/wireless/broadcom/b43/phy_n.c | |||
@@ -1518,7 +1518,7 @@ static int b43_nphy_load_samples(struct b43_wldev *dev, | |||
1518 | u16 i; | 1518 | u16 i; |
1519 | u32 *data; | 1519 | u32 *data; |
1520 | 1520 | ||
1521 | data = kzalloc(len * sizeof(u32), GFP_KERNEL); | 1521 | data = kcalloc(len, sizeof(u32), GFP_KERNEL); |
1522 | if (!data) { | 1522 | if (!data) { |
1523 | b43err(dev->wl, "allocation for samples loading failed\n"); | 1523 | b43err(dev->wl, "allocation for samples loading failed\n"); |
1524 | return -ENOMEM; | 1524 | return -ENOMEM; |
diff --git a/drivers/net/wireless/broadcom/b43legacy/main.c b/drivers/net/wireless/broadcom/b43legacy/main.c index f1e3dad57629..55f411925960 100644 --- a/drivers/net/wireless/broadcom/b43legacy/main.c +++ b/drivers/net/wireless/broadcom/b43legacy/main.c | |||
@@ -3300,8 +3300,8 @@ static int b43legacy_wireless_core_init(struct b43legacy_wldev *dev) | |||
3300 | 3300 | ||
3301 | if ((phy->type == B43legacy_PHYTYPE_B) || | 3301 | if ((phy->type == B43legacy_PHYTYPE_B) || |
3302 | (phy->type == B43legacy_PHYTYPE_G)) { | 3302 | (phy->type == B43legacy_PHYTYPE_G)) { |
3303 | phy->_lo_pairs = kzalloc(sizeof(struct b43legacy_lopair) | 3303 | phy->_lo_pairs = kcalloc(B43legacy_LO_COUNT, |
3304 | * B43legacy_LO_COUNT, | 3304 | sizeof(struct b43legacy_lopair), |
3305 | GFP_KERNEL); | 3305 | GFP_KERNEL); |
3306 | if (!phy->_lo_pairs) | 3306 | if (!phy->_lo_pairs) |
3307 | return -ENOMEM; | 3307 | return -ENOMEM; |
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c index 49d37ad96958..c40ba8855cd5 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | |||
@@ -1486,8 +1486,9 @@ int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr) | |||
1486 | (struct brcmf_commonring **)if_msgbuf->commonrings; | 1486 | (struct brcmf_commonring **)if_msgbuf->commonrings; |
1487 | msgbuf->flowrings = (struct brcmf_commonring **)if_msgbuf->flowrings; | 1487 | msgbuf->flowrings = (struct brcmf_commonring **)if_msgbuf->flowrings; |
1488 | msgbuf->max_flowrings = if_msgbuf->max_flowrings; | 1488 | msgbuf->max_flowrings = if_msgbuf->max_flowrings; |
1489 | msgbuf->flowring_dma_handle = kzalloc(msgbuf->max_flowrings * | 1489 | msgbuf->flowring_dma_handle = |
1490 | sizeof(*msgbuf->flowring_dma_handle), GFP_KERNEL); | 1490 | kcalloc(msgbuf->max_flowrings, |
1491 | sizeof(*msgbuf->flowring_dma_handle), GFP_KERNEL); | ||
1491 | if (!msgbuf->flowring_dma_handle) | 1492 | if (!msgbuf->flowring_dma_handle) |
1492 | goto fail; | 1493 | goto fail; |
1493 | 1494 | ||
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c index 4b2149b48362..3e9c4f2f5dd1 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | |||
@@ -1058,7 +1058,7 @@ static s32 brcmf_p2p_act_frm_search(struct brcmf_p2p_info *p2p, u16 channel) | |||
1058 | channel_cnt = AF_PEER_SEARCH_CNT; | 1058 | channel_cnt = AF_PEER_SEARCH_CNT; |
1059 | else | 1059 | else |
1060 | channel_cnt = SOCIAL_CHAN_CNT; | 1060 | channel_cnt = SOCIAL_CHAN_CNT; |
1061 | default_chan_list = kzalloc(channel_cnt * sizeof(*default_chan_list), | 1061 | default_chan_list = kcalloc(channel_cnt, sizeof(*default_chan_list), |
1062 | GFP_KERNEL); | 1062 | GFP_KERNEL); |
1063 | if (default_chan_list == NULL) { | 1063 | if (default_chan_list == NULL) { |
1064 | brcmf_err("channel list allocation failed\n"); | 1064 | brcmf_err("channel list allocation failed\n"); |
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c index 0a14942b8216..7d4e8f589fdc 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c | |||
@@ -507,7 +507,7 @@ brcms_c_attach_malloc(uint unit, uint *err, uint devid) | |||
507 | wlc->hw->wlc = wlc; | 507 | wlc->hw->wlc = wlc; |
508 | 508 | ||
509 | wlc->hw->bandstate[0] = | 509 | wlc->hw->bandstate[0] = |
510 | kzalloc(sizeof(struct brcms_hw_band) * MAXBANDS, GFP_ATOMIC); | 510 | kcalloc(MAXBANDS, sizeof(struct brcms_hw_band), GFP_ATOMIC); |
511 | if (wlc->hw->bandstate[0] == NULL) { | 511 | if (wlc->hw->bandstate[0] == NULL) { |
512 | *err = 1006; | 512 | *err = 1006; |
513 | goto fail; | 513 | goto fail; |
@@ -521,7 +521,8 @@ brcms_c_attach_malloc(uint unit, uint *err, uint devid) | |||
521 | } | 521 | } |
522 | 522 | ||
523 | wlc->modulecb = | 523 | wlc->modulecb = |
524 | kzalloc(sizeof(struct modulecb) * BRCMS_MAXMODULES, GFP_ATOMIC); | 524 | kcalloc(BRCMS_MAXMODULES, sizeof(struct modulecb), |
525 | GFP_ATOMIC); | ||
525 | if (wlc->modulecb == NULL) { | 526 | if (wlc->modulecb == NULL) { |
526 | *err = 1009; | 527 | *err = 1009; |
527 | goto fail; | 528 | goto fail; |
@@ -553,7 +554,7 @@ brcms_c_attach_malloc(uint unit, uint *err, uint devid) | |||
553 | } | 554 | } |
554 | 555 | ||
555 | wlc->bandstate[0] = | 556 | wlc->bandstate[0] = |
556 | kzalloc(sizeof(struct brcms_band)*MAXBANDS, GFP_ATOMIC); | 557 | kcalloc(MAXBANDS, sizeof(struct brcms_band), GFP_ATOMIC); |
557 | if (wlc->bandstate[0] == NULL) { | 558 | if (wlc->bandstate[0] == NULL) { |
558 | *err = 1025; | 559 | *err = 1025; |
559 | goto fail; | 560 | goto fail; |
diff --git a/drivers/net/wireless/intel/iwlegacy/common.c b/drivers/net/wireless/intel/iwlegacy/common.c index 063e19ced7c8..6514baf799fe 100644 --- a/drivers/net/wireless/intel/iwlegacy/common.c +++ b/drivers/net/wireless/intel/iwlegacy/common.c | |||
@@ -922,7 +922,7 @@ il_init_channel_map(struct il_priv *il) | |||
922 | D_EEPROM("Parsing data for %d channels.\n", il->channel_count); | 922 | D_EEPROM("Parsing data for %d channels.\n", il->channel_count); |
923 | 923 | ||
924 | il->channel_info = | 924 | il->channel_info = |
925 | kzalloc(sizeof(struct il_channel_info) * il->channel_count, | 925 | kcalloc(il->channel_count, sizeof(struct il_channel_info), |
926 | GFP_KERNEL); | 926 | GFP_KERNEL); |
927 | if (!il->channel_info) { | 927 | if (!il->channel_info) { |
928 | IL_ERR("Could not allocate channel_info\n"); | 928 | IL_ERR("Could not allocate channel_info\n"); |
@@ -3041,9 +3041,9 @@ il_tx_queue_init(struct il_priv *il, u32 txq_id) | |||
3041 | } | 3041 | } |
3042 | 3042 | ||
3043 | txq->meta = | 3043 | txq->meta = |
3044 | kzalloc(sizeof(struct il_cmd_meta) * actual_slots, GFP_KERNEL); | 3044 | kcalloc(actual_slots, sizeof(struct il_cmd_meta), GFP_KERNEL); |
3045 | txq->cmd = | 3045 | txq->cmd = |
3046 | kzalloc(sizeof(struct il_device_cmd *) * actual_slots, GFP_KERNEL); | 3046 | kcalloc(actual_slots, sizeof(struct il_device_cmd *), GFP_KERNEL); |
3047 | 3047 | ||
3048 | if (!txq->meta || !txq->cmd) | 3048 | if (!txq->meta || !txq->cmd) |
3049 | goto out_free_arrays; | 3049 | goto out_free_arrays; |
@@ -3455,7 +3455,7 @@ il_init_geos(struct il_priv *il) | |||
3455 | } | 3455 | } |
3456 | 3456 | ||
3457 | channels = | 3457 | channels = |
3458 | kzalloc(sizeof(struct ieee80211_channel) * il->channel_count, | 3458 | kcalloc(il->channel_count, sizeof(struct ieee80211_channel), |
3459 | GFP_KERNEL); | 3459 | GFP_KERNEL); |
3460 | if (!channels) | 3460 | if (!channels) |
3461 | return -ENOMEM; | 3461 | return -ENOMEM; |
@@ -4654,8 +4654,9 @@ il_alloc_txq_mem(struct il_priv *il) | |||
4654 | { | 4654 | { |
4655 | if (!il->txq) | 4655 | if (!il->txq) |
4656 | il->txq = | 4656 | il->txq = |
4657 | kzalloc(sizeof(struct il_tx_queue) * | 4657 | kcalloc(il->cfg->num_of_queues, |
4658 | il->cfg->num_of_queues, GFP_KERNEL); | 4658 | sizeof(struct il_tx_queue), |
4659 | GFP_KERNEL); | ||
4659 | if (!il->txq) { | 4660 | if (!il->txq) { |
4660 | IL_ERR("Not enough memory for txq\n"); | 4661 | IL_ERR("Not enough memory for txq\n"); |
4661 | return -ENOMEM; | 4662 | return -ENOMEM; |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c index 4b3753d78d03..11ecdf63b732 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c | |||
@@ -564,7 +564,7 @@ iwl_mvm_config_sched_scan_profiles(struct iwl_mvm *mvm, | |||
564 | else | 564 | else |
565 | blacklist_len = IWL_SCAN_MAX_BLACKLIST_LEN; | 565 | blacklist_len = IWL_SCAN_MAX_BLACKLIST_LEN; |
566 | 566 | ||
567 | blacklist = kzalloc(sizeof(*blacklist) * blacklist_len, GFP_KERNEL); | 567 | blacklist = kcalloc(blacklist_len, sizeof(*blacklist), GFP_KERNEL); |
568 | if (!blacklist) | 568 | if (!blacklist) |
569 | return -ENOMEM; | 569 | return -ENOMEM; |
570 | 570 | ||
diff --git a/drivers/net/wireless/intersil/p54/eeprom.c b/drivers/net/wireless/intersil/p54/eeprom.c index d4c73d39336f..de2ef95c386c 100644 --- a/drivers/net/wireless/intersil/p54/eeprom.c +++ b/drivers/net/wireless/intersil/p54/eeprom.c | |||
@@ -161,8 +161,9 @@ static int p54_generate_band(struct ieee80211_hw *dev, | |||
161 | if (!tmp) | 161 | if (!tmp) |
162 | goto err_out; | 162 | goto err_out; |
163 | 163 | ||
164 | tmp->channels = kzalloc(sizeof(struct ieee80211_channel) * | 164 | tmp->channels = kcalloc(list->band_channel_num[band], |
165 | list->band_channel_num[band], GFP_KERNEL); | 165 | sizeof(struct ieee80211_channel), |
166 | GFP_KERNEL); | ||
166 | if (!tmp->channels) | 167 | if (!tmp->channels) |
167 | goto err_out; | 168 | goto err_out; |
168 | 169 | ||
@@ -344,7 +345,7 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev) | |||
344 | goto free; | 345 | goto free; |
345 | } | 346 | } |
346 | priv->chan_num = max_channel_num; | 347 | priv->chan_num = max_channel_num; |
347 | priv->survey = kzalloc(sizeof(struct survey_info) * max_channel_num, | 348 | priv->survey = kcalloc(max_channel_num, sizeof(struct survey_info), |
348 | GFP_KERNEL); | 349 | GFP_KERNEL); |
349 | if (!priv->survey) { | 350 | if (!priv->survey) { |
350 | ret = -ENOMEM; | 351 | ret = -ENOMEM; |
@@ -352,8 +353,9 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev) | |||
352 | } | 353 | } |
353 | 354 | ||
354 | list->max_entries = max_channel_num; | 355 | list->max_entries = max_channel_num; |
355 | list->channels = kzalloc(sizeof(struct p54_channel_entry) * | 356 | list->channels = kcalloc(max_channel_num, |
356 | max_channel_num, GFP_KERNEL); | 357 | sizeof(struct p54_channel_entry), |
358 | GFP_KERNEL); | ||
357 | if (!list->channels) { | 359 | if (!list->channels) { |
358 | ret = -ENOMEM; | 360 | ret = -ENOMEM; |
359 | goto free; | 361 | goto free; |
diff --git a/drivers/net/wireless/intersil/prism54/oid_mgt.c b/drivers/net/wireless/intersil/prism54/oid_mgt.c index 6528ed5b9b1d..6d57e1cbcc07 100644 --- a/drivers/net/wireless/intersil/prism54/oid_mgt.c +++ b/drivers/net/wireless/intersil/prism54/oid_mgt.c | |||
@@ -244,7 +244,7 @@ mgt_init(islpci_private *priv) | |||
244 | /* Alloc the cache */ | 244 | /* Alloc the cache */ |
245 | for (i = 0; i < OID_NUM_LAST; i++) { | 245 | for (i = 0; i < OID_NUM_LAST; i++) { |
246 | if (isl_oid[i].flags & OID_FLAG_CACHED) { | 246 | if (isl_oid[i].flags & OID_FLAG_CACHED) { |
247 | priv->mib[i] = kzalloc(isl_oid[i].size * | 247 | priv->mib[i] = kcalloc(isl_oid[i].size, |
248 | (isl_oid[i].range + 1), | 248 | (isl_oid[i].range + 1), |
249 | GFP_KERNEL); | 249 | GFP_KERNEL); |
250 | if (!priv->mib[i]) | 250 | if (!priv->mib[i]) |
diff --git a/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c b/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c index 1edcddaf7b4b..7ab44cd32a9d 100644 --- a/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c +++ b/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c | |||
@@ -399,8 +399,8 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta, | |||
399 | 399 | ||
400 | new_node->win_size = win_size; | 400 | new_node->win_size = win_size; |
401 | 401 | ||
402 | new_node->rx_reorder_ptr = kzalloc(sizeof(void *) * win_size, | 402 | new_node->rx_reorder_ptr = kcalloc(win_size, sizeof(void *), |
403 | GFP_KERNEL); | 403 | GFP_KERNEL); |
404 | if (!new_node->rx_reorder_ptr) { | 404 | if (!new_node->rx_reorder_ptr) { |
405 | kfree((u8 *) new_node); | 405 | kfree((u8 *) new_node); |
406 | mwifiex_dbg(priv->adapter, ERROR, | 406 | mwifiex_dbg(priv->adapter, ERROR, |
diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c index 47d2dcc3f28f..dfdcbc4f141a 100644 --- a/drivers/net/wireless/marvell/mwifiex/sdio.c +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c | |||
@@ -2106,15 +2106,16 @@ static int mwifiex_init_sdio(struct mwifiex_adapter *adapter) | |||
2106 | return -ENOMEM; | 2106 | return -ENOMEM; |
2107 | 2107 | ||
2108 | /* Allocate skb pointer buffers */ | 2108 | /* Allocate skb pointer buffers */ |
2109 | card->mpa_rx.skb_arr = kzalloc((sizeof(void *)) * | 2109 | card->mpa_rx.skb_arr = kcalloc(card->mp_agg_pkt_limit, sizeof(void *), |
2110 | card->mp_agg_pkt_limit, GFP_KERNEL); | 2110 | GFP_KERNEL); |
2111 | if (!card->mpa_rx.skb_arr) { | 2111 | if (!card->mpa_rx.skb_arr) { |
2112 | kfree(card->mp_regs); | 2112 | kfree(card->mp_regs); |
2113 | return -ENOMEM; | 2113 | return -ENOMEM; |
2114 | } | 2114 | } |
2115 | 2115 | ||
2116 | card->mpa_rx.len_arr = kzalloc(sizeof(*card->mpa_rx.len_arr) * | 2116 | card->mpa_rx.len_arr = kcalloc(card->mp_agg_pkt_limit, |
2117 | card->mp_agg_pkt_limit, GFP_KERNEL); | 2117 | sizeof(*card->mpa_rx.len_arr), |
2118 | GFP_KERNEL); | ||
2118 | if (!card->mpa_rx.len_arr) { | 2119 | if (!card->mpa_rx.len_arr) { |
2119 | kfree(card->mp_regs); | 2120 | kfree(card->mp_regs); |
2120 | kfree(card->mpa_rx.skb_arr); | 2121 | kfree(card->mpa_rx.skb_arr); |
diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c index 5eb143667539..c5d94a95e21a 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.c +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c | |||
@@ -1216,7 +1216,7 @@ static int qtnf_parse_variable_mac_info(struct qtnf_wmac *mac, | |||
1216 | return -EINVAL; | 1216 | return -EINVAL; |
1217 | } | 1217 | } |
1218 | 1218 | ||
1219 | limits = kzalloc(sizeof(*limits) * rec->n_limits, | 1219 | limits = kcalloc(rec->n_limits, sizeof(*limits), |
1220 | GFP_KERNEL); | 1220 | GFP_KERNEL); |
1221 | if (!limits) | 1221 | if (!limits) |
1222 | return -ENOMEM; | 1222 | return -ENOMEM; |
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c b/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c index 0eee479583b8..acc399b5574e 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c | |||
@@ -397,7 +397,7 @@ static ssize_t rt2x00debug_read_crypto_stats(struct file *file, | |||
397 | if (*offset) | 397 | if (*offset) |
398 | return 0; | 398 | return 0; |
399 | 399 | ||
400 | data = kzalloc((1 + CIPHER_MAX) * MAX_LINE_LENGTH, GFP_KERNEL); | 400 | data = kcalloc(1 + CIPHER_MAX, MAX_LINE_LENGTH, GFP_KERNEL); |
401 | if (!data) | 401 | if (!data) |
402 | return -ENOMEM; | 402 | return -ENOMEM; |
403 | 403 | ||
diff --git a/drivers/net/wireless/realtek/rtlwifi/efuse.c b/drivers/net/wireless/realtek/rtlwifi/efuse.c index fd13d4ef53b8..9729e51fce38 100644 --- a/drivers/net/wireless/realtek/rtlwifi/efuse.c +++ b/drivers/net/wireless/realtek/rtlwifi/efuse.c | |||
@@ -258,8 +258,8 @@ void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf) | |||
258 | } | 258 | } |
259 | 259 | ||
260 | /* allocate memory for efuse_tbl and efuse_word */ | 260 | /* allocate memory for efuse_tbl and efuse_word */ |
261 | efuse_tbl = kzalloc(rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE] * | 261 | efuse_tbl = kzalloc(rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE], |
262 | sizeof(u8), GFP_ATOMIC); | 262 | GFP_ATOMIC); |
263 | if (!efuse_tbl) | 263 | if (!efuse_tbl) |
264 | return; | 264 | return; |
265 | efuse_word = kcalloc(EFUSE_MAX_WORD_UNIT, sizeof(u16 *), GFP_ATOMIC); | 265 | efuse_word = kcalloc(EFUSE_MAX_WORD_UNIT, sizeof(u16 *), GFP_ATOMIC); |
diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c b/drivers/net/wireless/realtek/rtlwifi/usb.c index ce3103bb8ebb..f9faffc498bc 100644 --- a/drivers/net/wireless/realtek/rtlwifi/usb.c +++ b/drivers/net/wireless/realtek/rtlwifi/usb.c | |||
@@ -1048,7 +1048,7 @@ int rtl_usb_probe(struct usb_interface *intf, | |||
1048 | } | 1048 | } |
1049 | rtlpriv = hw->priv; | 1049 | rtlpriv = hw->priv; |
1050 | rtlpriv->hw = hw; | 1050 | rtlpriv->hw = hw; |
1051 | rtlpriv->usb_data = kzalloc(RTL_USB_MAX_RX_COUNT * sizeof(u32), | 1051 | rtlpriv->usb_data = kcalloc(RTL_USB_MAX_RX_COUNT, sizeof(u32), |
1052 | GFP_KERNEL); | 1052 | GFP_KERNEL); |
1053 | if (!rtlpriv->usb_data) | 1053 | if (!rtlpriv->usb_data) |
1054 | return -ENOMEM; | 1054 | return -ENOMEM; |
diff --git a/drivers/net/wireless/st/cw1200/queue.c b/drivers/net/wireless/st/cw1200/queue.c index 5153d2cfd991..7c31b63b8258 100644 --- a/drivers/net/wireless/st/cw1200/queue.c +++ b/drivers/net/wireless/st/cw1200/queue.c | |||
@@ -154,7 +154,7 @@ int cw1200_queue_stats_init(struct cw1200_queue_stats *stats, | |||
154 | spin_lock_init(&stats->lock); | 154 | spin_lock_init(&stats->lock); |
155 | init_waitqueue_head(&stats->wait_link_id_empty); | 155 | init_waitqueue_head(&stats->wait_link_id_empty); |
156 | 156 | ||
157 | stats->link_map_cache = kzalloc(sizeof(int) * map_capacity, | 157 | stats->link_map_cache = kcalloc(map_capacity, sizeof(int), |
158 | GFP_KERNEL); | 158 | GFP_KERNEL); |
159 | if (!stats->link_map_cache) | 159 | if (!stats->link_map_cache) |
160 | return -ENOMEM; | 160 | return -ENOMEM; |
@@ -181,13 +181,13 @@ int cw1200_queue_init(struct cw1200_queue *queue, | |||
181 | spin_lock_init(&queue->lock); | 181 | spin_lock_init(&queue->lock); |
182 | timer_setup(&queue->gc, cw1200_queue_gc, 0); | 182 | timer_setup(&queue->gc, cw1200_queue_gc, 0); |
183 | 183 | ||
184 | queue->pool = kzalloc(sizeof(struct cw1200_queue_item) * capacity, | 184 | queue->pool = kcalloc(capacity, sizeof(struct cw1200_queue_item), |
185 | GFP_KERNEL); | 185 | GFP_KERNEL); |
186 | if (!queue->pool) | 186 | if (!queue->pool) |
187 | return -ENOMEM; | 187 | return -ENOMEM; |
188 | 188 | ||
189 | queue->link_map_cache = kzalloc(sizeof(int) * stats->map_capacity, | 189 | queue->link_map_cache = kcalloc(stats->map_capacity, sizeof(int), |
190 | GFP_KERNEL); | 190 | GFP_KERNEL); |
191 | if (!queue->link_map_cache) { | 191 | if (!queue->link_map_cache) { |
192 | kfree(queue->pool); | 192 | kfree(queue->pool); |
193 | queue->pool = NULL; | 193 | queue->pool = NULL; |
diff --git a/drivers/net/wireless/st/cw1200/scan.c b/drivers/net/wireless/st/cw1200/scan.c index cc2ce60f4f09..67213f11acbd 100644 --- a/drivers/net/wireless/st/cw1200/scan.c +++ b/drivers/net/wireless/st/cw1200/scan.c | |||
@@ -230,9 +230,9 @@ void cw1200_scan_work(struct work_struct *work) | |||
230 | scan.type = WSM_SCAN_TYPE_BACKGROUND; | 230 | scan.type = WSM_SCAN_TYPE_BACKGROUND; |
231 | scan.flags = WSM_SCAN_FLAG_FORCE_BACKGROUND; | 231 | scan.flags = WSM_SCAN_FLAG_FORCE_BACKGROUND; |
232 | } | 232 | } |
233 | scan.ch = kzalloc( | 233 | scan.ch = kcalloc(it - priv->scan.curr, |
234 | sizeof(struct wsm_scan_ch) * (it - priv->scan.curr), | 234 | sizeof(struct wsm_scan_ch), |
235 | GFP_KERNEL); | 235 | GFP_KERNEL); |
236 | if (!scan.ch) { | 236 | if (!scan.ch) { |
237 | priv->scan.status = -ENOMEM; | 237 | priv->scan.status = -ENOMEM; |
238 | goto fail; | 238 | goto fail; |