linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] drivers/pinctrl/freescale: Use kmemdup_array instead of kmemdup for multiple allocation
@ 2024-08-23  1:39 Shen Lichuan
  2024-08-23  9:16 ` Peng Fan
  2024-08-23 15:19 ` Andy Shevchenko
  0 siblings, 2 replies; 3+ messages in thread
From: Shen Lichuan @ 2024-08-23  1:39 UTC (permalink / raw)
  To: aisheng.dong, festevam, shawnguo, ping.bai, linus.walleij,
	s.hauer
  Cc: kernel, linux-gpio, imx, linux-arm-kernel, linux-kernel,
	Shen Lichuan

Let the kememdup_array() take care about
multiplication and possible overflows.

Signed-off-by: Shen Lichuan <shenlichuan@vivo.com>
---
 drivers/pinctrl/freescale/pinctrl-imx-scmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx-scmi.c b/drivers/pinctrl/freescale/pinctrl-imx-scmi.c
index 2991047535bc..8f15c4c4dc44 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx-scmi.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx-scmi.c
@@ -130,7 +130,7 @@ static int pinctrl_scmi_imx_dt_node_to_map(struct pinctrl_dev *pctldev,
 			cfg[j++] = pinconf_to_config_packed(IMX_SCMI_PIN_DAISY_CFG, input_val);
 		}
 
-		configs = kmemdup(cfg, ncfg * sizeof(unsigned long), GFP_KERNEL);
+		configs = kmemdup_array(cfg, ncfg, sizeof(unsigned long), GFP_KERNEL);
 
 		new_map[i].type = PIN_MAP_TYPE_CONFIGS_PIN;
 		new_map[i].data.configs.group_or_pin = pin_get_name(pctldev, pin_id);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-23 15:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-23  1:39 [PATCH v1] drivers/pinctrl/freescale: Use kmemdup_array instead of kmemdup for multiple allocation Shen Lichuan
2024-08-23  9:16 ` Peng Fan
2024-08-23 15:19 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).