linux/drivers/bus
Erick Archer ae1d892d51 bus: mhi: ep: Use kcalloc() instead of kzalloc()
This is an effort to get rid of all multiplications from allocation
functions in order to prevent integer overflows [1].

Here the multiplication is obviously safe because the "event_rings"
member never can have a value greater than 255 (8 bits). This member
is set twice using always FIELD_GET:

mhi_cntrl->event_rings = FIELD_GET(MHICFG_NER_MASK, regval);
mhi_cntrl->event_rings = FIELD_GET(MHICFG_NER_MASK, regval);

And the MHICFG_NER_MASK macro defines the 8 bits mask that guarantees
a maximum value of 255.

However, using kcalloc() is more appropriate [1] and improves
readability. This patch has no effect on runtime behavior.

Link: https://github.com/KSPP/linux/issues/162 [1]
Link: https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments [1]
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Erick Archer <erick.archer@gmx.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20240128112722.4334-1-erick.archer@gmx.com
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2024-02-03 10:26:45 +05:30
..
fsl-mc bus: fsl-mc: Convert to platform remove callback returning void 2023-11-16 12:43:56 +01:00
mhi bus: mhi: ep: Use kcalloc() instead of kzalloc() 2024-02-03 10:26:45 +05:30
arm-cci.c
arm-integrator-lm.c bus: arm-integrator-lm: remove MODULE_LICENSE in non-modules 2023-04-13 13:13:50 -07:00
brcmstb_gisb.c bus: brcmstb_gisb: Use devm_platform_get_and_ioremap_resource() 2023-03-14 14:07:16 -07:00
bt1-apb.c bus: remove MODULE_LICENSE in non-modules 2023-04-13 13:13:53 -07:00
bt1-axi.c bus: remove MODULE_LICENSE in non-modules 2023-04-13 13:13:53 -07:00
da8xx-mstpri.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
hisi_lpc.c bus: hisi_lpc: Convert to platform remove callback returning void 2023-11-28 18:43:26 +01:00
imx-weim.c bus: imx-weim: Use device_get_match_data() 2023-11-27 11:05:30 +08:00
intel-ixp4xx-eb.c bus: ixp4xx: fix IXP4XX_EXP_T1_MASK 2023-07-05 22:22:55 +02:00
Kconfig bus: brcmstb_gisb: Depend on SoC specifics over generic arm 2023-10-09 11:51:08 -07:00
Makefile bus: add driver for initializing the SSC bus on (some) qcom SoCs 2022-04-19 13:03:57 -05:00
mips_cdmm.c driver core: make struct bus_type.uevent() take a const * 2023-01-27 13:45:52 +01:00
moxtet.c Char/Misc and other Driver changes for 6.8-rc1 2024-01-17 16:47:17 -08:00
mvebu-mbus.c bus: mvebu-mbus: Remove open coded "ranges" parsing 2023-04-18 11:18:24 -05:00
omap_l3_noc.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_320.RULE 2022-06-10 14:51:36 +02:00
omap_l3_noc.h treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_320.RULE 2022-06-10 14:51:36 +02:00
omap_l3_smx.c bus: omap_l3_smx: Convert to platform remove callback returning void 2023-11-28 18:43:26 +01:00
omap_l3_smx.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
omap-ocp2scp.c bus: omap-ocp2scp: Convert to platform remove callback returning void 2023-11-28 18:43:26 +01:00
qcom-ebi2.c bus: qcom: remove MODULE_LICENSE in non-modules 2023-04-13 13:13:50 -07:00
qcom-ssc-block-bus.c bus: qcom-ssc-block-bus: Convert to platform remove callback returning void 2023-11-28 18:43:26 +01:00
simple-pm-bus.c bus: simple-pm-bus: Convert to platform remove callback returning void 2023-11-28 18:43:26 +01:00
sun50i-de2.c bus: sun50i-de2: Convert to platform remove callback returning void 2023-11-28 18:43:26 +01:00
sunxi-rsb.c bus: sunxi-rsb: Convert to platform remove callback returning void 2023-11-28 18:43:26 +01:00
tegra-aconnect.c bus: tegra-aconnect: Convert to platform remove callback returning void 2023-11-28 18:43:26 +01:00
tegra-gmi.c bus: tegra-gmi: Convert to platform remove callback returning void 2023-11-28 18:43:26 +01:00
ti-pwmss.c bus: ti-pwmss: Convert to platform remove callback returning void 2023-11-28 18:43:27 +01:00
ti-sysc.c SoC: driver updates for 6.8 2024-01-11 11:31:46 -08:00
ts-nbus.c bus: ts-nbus: Convert to platform remove callback returning void 2023-11-28 18:43:27 +01:00
uniphier-system-bus.c bus: uniphier-system-bus: Remove open coded "ranges" parsing 2023-03-30 13:37:21 -05:00
vexpress-config.c bus: vexpress-config: Annotate struct vexpress_syscfg_func with __counted_by 2023-09-25 19:38:27 +01:00