Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'alloc-args-v4.19-rc8' of https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux

Kees writes:
"Fix open-coded multiplication arguments to allocators

- Fixes several new open-coded multiplications added in the 4.19
merge window."

* tag 'alloc-args-v4.19-rc8' of https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
treewide: Replace more open-coded allocation size multiplications

+22 -19
+1 -1
drivers/bluetooth/hci_qca.c
··· 1322 1322 { 1323 1323 int i; 1324 1324 1325 - qca->vreg_bulk = devm_kzalloc(qca->dev, num_vregs * 1325 + qca->vreg_bulk = devm_kcalloc(qca->dev, num_vregs, 1326 1326 sizeof(struct regulator_bulk_data), 1327 1327 GFP_KERNEL); 1328 1328 if (!qca->vreg_bulk)
+5 -3
drivers/crypto/inside-secure/safexcel.c
··· 1044 1044 1045 1045 safexcel_configure(priv); 1046 1046 1047 - priv->ring = devm_kzalloc(dev, priv->config.rings * sizeof(*priv->ring), 1047 + priv->ring = devm_kcalloc(dev, priv->config.rings, 1048 + sizeof(*priv->ring), 1048 1049 GFP_KERNEL); 1049 1050 if (!priv->ring) { 1050 1051 ret = -ENOMEM; ··· 1064 1063 if (ret) 1065 1064 goto err_reg_clk; 1066 1065 1067 - priv->ring[i].rdr_req = devm_kzalloc(dev, 1068 - sizeof(priv->ring[i].rdr_req) * EIP197_DEFAULT_RING_SIZE, 1066 + priv->ring[i].rdr_req = devm_kcalloc(dev, 1067 + EIP197_DEFAULT_RING_SIZE, 1068 + sizeof(priv->ring[i].rdr_req), 1069 1069 GFP_KERNEL); 1070 1070 if (!priv->ring[i].rdr_req) { 1071 1071 ret = -ENOMEM;
+1 -1
drivers/gpu/drm/mediatek/mtk_drm_crtc.c
··· 600 600 } 601 601 602 602 mtk_crtc->layer_nr = mtk_ddp_comp_layer_nr(mtk_crtc->ddp_comp[0]); 603 - mtk_crtc->planes = devm_kzalloc(dev, mtk_crtc->layer_nr * 603 + mtk_crtc->planes = devm_kcalloc(dev, mtk_crtc->layer_nr, 604 604 sizeof(struct drm_plane), 605 605 GFP_KERNEL); 606 606
+2 -2
drivers/gpu/drm/msm/disp/dpu1/dpu_io_util.c
··· 153 153 return 0; 154 154 } 155 155 156 - mp->clk_config = devm_kzalloc(&pdev->dev, 157 - sizeof(struct dss_clk) * num_clk, 156 + mp->clk_config = devm_kcalloc(&pdev->dev, 157 + num_clk, sizeof(struct dss_clk), 158 158 GFP_KERNEL); 159 159 if (!mp->clk_config) 160 160 return -ENOMEM;
+1 -1
drivers/hwmon/npcm750-pwm-fan.c
··· 908 908 if (fan_cnt < 1) 909 909 return -EINVAL; 910 910 911 - fan_ch = devm_kzalloc(dev, sizeof(*fan_ch) * fan_cnt, GFP_KERNEL); 911 + fan_ch = devm_kcalloc(dev, fan_cnt, sizeof(*fan_ch), GFP_KERNEL); 912 912 if (!fan_ch) 913 913 return -ENOMEM; 914 914
+2 -1
drivers/md/dm-integrity.c
··· 3462 3462 r = -ENOMEM; 3463 3463 goto bad; 3464 3464 } 3465 - ic->recalc_tags = kvmalloc((RECALC_SECTORS >> ic->sb->log2_sectors_per_block) * ic->tag_size, GFP_KERNEL); 3465 + ic->recalc_tags = kvmalloc_array(RECALC_SECTORS >> ic->sb->log2_sectors_per_block, 3466 + ic->tag_size, GFP_KERNEL); 3466 3467 if (!ic->recalc_tags) { 3467 3468 ti->error = "Cannot allocate tags for recalculating"; 3468 3469 r = -ENOMEM;
+5 -5
drivers/net/wireless/mediatek/mt76/usb.c
··· 258 258 if (!buf->urb) 259 259 return -ENOMEM; 260 260 261 - buf->urb->sg = devm_kzalloc(dev->dev, nsgs * sizeof(*buf->urb->sg), 261 + buf->urb->sg = devm_kcalloc(dev->dev, nsgs, sizeof(*buf->urb->sg), 262 262 gfp); 263 263 if (!buf->urb->sg) 264 264 return -ENOMEM; ··· 464 464 int i, err, nsgs; 465 465 466 466 spin_lock_init(&q->lock); 467 - q->entry = devm_kzalloc(dev->dev, 468 - MT_NUM_RX_ENTRIES * sizeof(*q->entry), 467 + q->entry = devm_kcalloc(dev->dev, 468 + MT_NUM_RX_ENTRIES, sizeof(*q->entry), 469 469 GFP_KERNEL); 470 470 if (!q->entry) 471 471 return -ENOMEM; ··· 717 717 INIT_LIST_HEAD(&q->swq); 718 718 q->hw_idx = q2hwq(i); 719 719 720 - q->entry = devm_kzalloc(dev->dev, 721 - MT_NUM_TX_ENTRIES * sizeof(*q->entry), 720 + q->entry = devm_kcalloc(dev->dev, 721 + MT_NUM_TX_ENTRIES, sizeof(*q->entry), 722 722 GFP_KERNEL); 723 723 if (!q->entry) 724 724 return -ENOMEM;
+2 -2
drivers/pci/controller/pcie-cadence.c
··· 180 180 return 0; 181 181 } 182 182 183 - phy = devm_kzalloc(dev, sizeof(*phy) * phy_count, GFP_KERNEL); 183 + phy = devm_kcalloc(dev, phy_count, sizeof(*phy), GFP_KERNEL); 184 184 if (!phy) 185 185 return -ENOMEM; 186 186 187 - link = devm_kzalloc(dev, sizeof(*link) * phy_count, GFP_KERNEL); 187 + link = devm_kcalloc(dev, phy_count, sizeof(*link), GFP_KERNEL); 188 188 if (!link) 189 189 return -ENOMEM; 190 190
+2 -2
drivers/tty/serial/qcom_geni_serial.c
··· 868 868 geni_se_init(&port->se, port->rx_wm, port->rx_rfr); 869 869 geni_se_select_mode(&port->se, port->xfer_mode); 870 870 if (!uart_console(uport)) { 871 - port->rx_fifo = devm_kzalloc(uport->dev, 872 - port->rx_fifo_depth * sizeof(u32), GFP_KERNEL); 871 + port->rx_fifo = devm_kcalloc(uport->dev, 872 + port->rx_fifo_depth, sizeof(u32), GFP_KERNEL); 873 873 if (!port->rx_fifo) 874 874 return -ENOMEM; 875 875 }
+1 -1
net/sched/sch_cake.c
··· 2644 2644 for (i = 1; i <= CAKE_QUEUES; i++) 2645 2645 quantum_div[i] = 65535 / i; 2646 2646 2647 - q->tins = kvzalloc(CAKE_MAX_TINS * sizeof(struct cake_tin_data), 2647 + q->tins = kvcalloc(CAKE_MAX_TINS, sizeof(struct cake_tin_data), 2648 2648 GFP_KERNEL); 2649 2649 if (!q->tins) 2650 2650 goto nomem;