aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-10-11 13:10:30 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-10-11 13:10:30 -0400
commit834d3cd294abd9ad81c6cbaefdda28aa491ceb06 (patch)
treeac7f551b7192bc9236bc45d4641053267733a8e1
parent9f203e2f2f065cd74553e6474f0ae3675f39fb0f (diff)
parent329e09893909d409039f6a79757d9b80b67efe39 (diff)
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
-rw-r--r--drivers/bluetooth/hci_qca.c2
-rw-r--r--drivers/crypto/inside-secure/safexcel.c8
-rw-r--r--drivers/gpu/drm/mediatek/mtk_drm_crtc.c2
-rw-r--r--drivers/gpu/drm/msm/disp/dpu1/dpu_io_util.c4
-rw-r--r--drivers/hwmon/npcm750-pwm-fan.c2
-rw-r--r--drivers/md/dm-integrity.c3
-rw-r--r--drivers/net/wireless/mediatek/mt76/usb.c10
-rw-r--r--drivers/pci/controller/pcie-cadence.c4
-rw-r--r--drivers/tty/serial/qcom_geni_serial.c4
-rw-r--r--net/sched/sch_cake.c2
10 files changed, 22 insertions, 19 deletions
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index e182f6019f68..2fee65886d50 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -1322,7 +1322,7 @@ static int qca_init_regulators(struct qca_power *qca,
1322{ 1322{
1323 int i; 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 sizeof(struct regulator_bulk_data), 1326 sizeof(struct regulator_bulk_data),
1327 GFP_KERNEL); 1327 GFP_KERNEL);
1328 if (!qca->vreg_bulk) 1328 if (!qca->vreg_bulk)
diff --git a/drivers/crypto/inside-secure/safexcel.c b/drivers/crypto/inside-secure/safexcel.c
index 7e71043457a6..86c699c14f84 100644
--- a/drivers/crypto/inside-secure/safexcel.c
+++ b/drivers/crypto/inside-secure/safexcel.c
@@ -1044,7 +1044,8 @@ static int safexcel_probe(struct platform_device *pdev)
1044 1044
1045 safexcel_configure(priv); 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 GFP_KERNEL); 1049 GFP_KERNEL);
1049 if (!priv->ring) { 1050 if (!priv->ring) {
1050 ret = -ENOMEM; 1051 ret = -ENOMEM;
@@ -1063,8 +1064,9 @@ static int safexcel_probe(struct platform_device *pdev)
1063 if (ret) 1064 if (ret)
1064 goto err_reg_clk; 1065 goto err_reg_clk;
1065 1066
1066 priv->ring[i].rdr_req = devm_kzalloc(dev, 1067 priv->ring[i].rdr_req = devm_kcalloc(dev,
1067 sizeof(priv->ring[i].rdr_req) * EIP197_DEFAULT_RING_SIZE, 1068 EIP197_DEFAULT_RING_SIZE,
1069 sizeof(priv->ring[i].rdr_req),
1068 GFP_KERNEL); 1070 GFP_KERNEL);
1069 if (!priv->ring[i].rdr_req) { 1071 if (!priv->ring[i].rdr_req) {
1070 ret = -ENOMEM; 1072 ret = -ENOMEM;
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index 0b976dfd04df..92ecb9bf982c 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -600,7 +600,7 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
600 } 600 }
601 601
602 mtk_crtc->layer_nr = mtk_ddp_comp_layer_nr(mtk_crtc->ddp_comp[0]); 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 sizeof(struct drm_plane), 604 sizeof(struct drm_plane),
605 GFP_KERNEL); 605 GFP_KERNEL);
606 606
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_io_util.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_io_util.c
index 790d39f816dc..b557687b1964 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_io_util.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_io_util.c
@@ -153,8 +153,8 @@ int msm_dss_parse_clock(struct platform_device *pdev,
153 return 0; 153 return 0;
154 } 154 }
155 155
156 mp->clk_config = devm_kzalloc(&pdev->dev, 156 mp->clk_config = devm_kcalloc(&pdev->dev,
157 sizeof(struct dss_clk) * num_clk, 157 num_clk, sizeof(struct dss_clk),
158 GFP_KERNEL); 158 GFP_KERNEL);
159 if (!mp->clk_config) 159 if (!mp->clk_config)
160 return -ENOMEM; 160 return -ENOMEM;
diff --git a/drivers/hwmon/npcm750-pwm-fan.c b/drivers/hwmon/npcm750-pwm-fan.c
index 8474d601aa63..b998f9fbed41 100644
--- a/drivers/hwmon/npcm750-pwm-fan.c
+++ b/drivers/hwmon/npcm750-pwm-fan.c
@@ -908,7 +908,7 @@ static int npcm7xx_en_pwm_fan(struct device *dev,
908 if (fan_cnt < 1) 908 if (fan_cnt < 1)
909 return -EINVAL; 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 if (!fan_ch) 912 if (!fan_ch)
913 return -ENOMEM; 913 return -ENOMEM;
914 914
diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
index 89ccb64342de..e1fa6baf4e8e 100644
--- a/drivers/md/dm-integrity.c
+++ b/drivers/md/dm-integrity.c
@@ -3462,7 +3462,8 @@ try_smaller_buffer:
3462 r = -ENOMEM; 3462 r = -ENOMEM;
3463 goto bad; 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 if (!ic->recalc_tags) { 3467 if (!ic->recalc_tags) {
3467 ti->error = "Cannot allocate tags for recalculating"; 3468 ti->error = "Cannot allocate tags for recalculating";
3468 r = -ENOMEM; 3469 r = -ENOMEM;
diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c
index 7780b07543bb..79e59f2379a2 100644
--- a/drivers/net/wireless/mediatek/mt76/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/usb.c
@@ -258,7 +258,7 @@ int mt76u_buf_alloc(struct mt76_dev *dev, struct mt76u_buf *buf,
258 if (!buf->urb) 258 if (!buf->urb)
259 return -ENOMEM; 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 gfp); 262 gfp);
263 if (!buf->urb->sg) 263 if (!buf->urb->sg)
264 return -ENOMEM; 264 return -ENOMEM;
@@ -464,8 +464,8 @@ static int mt76u_alloc_rx(struct mt76_dev *dev)
464 int i, err, nsgs; 464 int i, err, nsgs;
465 465
466 spin_lock_init(&q->lock); 466 spin_lock_init(&q->lock);
467 q->entry = devm_kzalloc(dev->dev, 467 q->entry = devm_kcalloc(dev->dev,
468 MT_NUM_RX_ENTRIES * sizeof(*q->entry), 468 MT_NUM_RX_ENTRIES, sizeof(*q->entry),
469 GFP_KERNEL); 469 GFP_KERNEL);
470 if (!q->entry) 470 if (!q->entry)
471 return -ENOMEM; 471 return -ENOMEM;
@@ -717,8 +717,8 @@ static int mt76u_alloc_tx(struct mt76_dev *dev)
717 INIT_LIST_HEAD(&q->swq); 717 INIT_LIST_HEAD(&q->swq);
718 q->hw_idx = q2hwq(i); 718 q->hw_idx = q2hwq(i);
719 719
720 q->entry = devm_kzalloc(dev->dev, 720 q->entry = devm_kcalloc(dev->dev,
721 MT_NUM_TX_ENTRIES * sizeof(*q->entry), 721 MT_NUM_TX_ENTRIES, sizeof(*q->entry),
722 GFP_KERNEL); 722 GFP_KERNEL);
723 if (!q->entry) 723 if (!q->entry)
724 return -ENOMEM; 724 return -ENOMEM;
diff --git a/drivers/pci/controller/pcie-cadence.c b/drivers/pci/controller/pcie-cadence.c
index 86f1b002c846..975bcdd6b5c0 100644
--- a/drivers/pci/controller/pcie-cadence.c
+++ b/drivers/pci/controller/pcie-cadence.c
@@ -180,11 +180,11 @@ int cdns_pcie_init_phy(struct device *dev, struct cdns_pcie *pcie)
180 return 0; 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 if (!phy) 184 if (!phy)
185 return -ENOMEM; 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 if (!link) 188 if (!link)
189 return -ENOMEM; 189 return -ENOMEM;
190 190
diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
index 29ec34387246..1515074e18fb 100644
--- a/drivers/tty/serial/qcom_geni_serial.c
+++ b/drivers/tty/serial/qcom_geni_serial.c
@@ -868,8 +868,8 @@ static int qcom_geni_serial_port_setup(struct uart_port *uport)
868 geni_se_init(&port->se, port->rx_wm, port->rx_rfr); 868 geni_se_init(&port->se, port->rx_wm, port->rx_rfr);
869 geni_se_select_mode(&port->se, port->xfer_mode); 869 geni_se_select_mode(&port->se, port->xfer_mode);
870 if (!uart_console(uport)) { 870 if (!uart_console(uport)) {
871 port->rx_fifo = devm_kzalloc(uport->dev, 871 port->rx_fifo = devm_kcalloc(uport->dev,
872 port->rx_fifo_depth * sizeof(u32), GFP_KERNEL); 872 port->rx_fifo_depth, sizeof(u32), GFP_KERNEL);
873 if (!port->rx_fifo) 873 if (!port->rx_fifo)
874 return -ENOMEM; 874 return -ENOMEM;
875 } 875 }
diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c
index c07c30b916d5..793016d722ec 100644
--- a/net/sched/sch_cake.c
+++ b/net/sched/sch_cake.c
@@ -2644,7 +2644,7 @@ static int cake_init(struct Qdisc *sch, struct nlattr *opt,
2644 for (i = 1; i <= CAKE_QUEUES; i++) 2644 for (i = 1; i <= CAKE_QUEUES; i++)
2645 quantum_div[i] = 65535 / i; 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 GFP_KERNEL); 2648 GFP_KERNEL);
2649 if (!q->tins) 2649 if (!q->tins)
2650 goto nomem; 2650 goto nomem;