Skip to contentSkip to conversation

pinctrl: pinconf-generic: Use kmemdup_array() over kmemdup()

PATCH In review Yash Suthar 2 participants 2 messages Apr 18 – Apr 28

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: pinconf-generic: Use kmemdup_array() over kmemdup()

using kmemdup_array instead of kmemdup ,as it is more readable and matches the intent of the api. tested with w=1, no new warnings introduced.

---
 drivers/pinctrl/pinconf-generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/pinconf-generic.c +1 -1
index 2b030bd0e6ad..b5c1587bf2e6 100644
@@ -371,7 +371,7 @@ int pinconf_generic_parse_dt_config(struct device_node *np,
 	 * Now limit the number of configs to the real number of
 	 * found properties.
 	 */
-	*configs = kmemdup(cfg, ncfg * sizeof(unsigned long), GFP_KERNEL);
+	*configs = kmemdup_array(cfg, ncfg, sizeof(unsigned long), GFP_KERNEL);
 	if (!*configs) {
 		ret = -ENOMEM;
 		goto out;
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 5 lines · Yash Suthar

using kmemdup_array instead of kmemdup ,as it is more readable and matches the intent of the api. tested with w=1, no new warnings introduced.

Patch applied!

Yours,
Linus Walleij