lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250212202311.3741443-1-chenyuan0y@gmail.com>
Date: Wed, 12 Feb 2025 14:23:11 -0600
From: Chenyuan Yang <chenyuan0y@...il.com>
To: avifishman70@...il.com,
	tmaimon77@...il.com,
	tali.perry1@...il.com,
	venture@...gle.com,
	yuenn@...gle.com,
	benjaminfair@...gle.com,
	linus.walleij@...aro.org
Cc: openbmc@...ts.ozlabs.org,
	linux-gpio@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Chenyuan Yang <chenyuan0y@...il.com>
Subject: [PATCH] pinctrl: nuvoton: Add NULL pointer check in npcm8xx_gpio_fw()

Add a NULL pointer check for pctrl->gpio_bank[id].gc.label in
npcm8xx_gpio_fw() to prevent potential NULL pointer dereference.
This is similar to the fix in commit 3027e7b15b02 
("ice: Fix some null pointer dereference issues in ice_ptp.c").

The npcm7xx driver already has this check in its npcm7xx_gpio_fw()
function, which provides similar functionality.
Add the same protection to npcm8xx.

Signed-off-by: Chenyuan Yang <chenyuan0y@...il.com>
---
 drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
index 471f644c5eef..d09a5e9b2eca 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
@@ -2374,6 +2374,9 @@ static int npcm8xx_gpio_fw(struct npcm8xx_pinctrl *pctrl)
 		pctrl->gpio_bank[id].gc.parent = dev;
 		pctrl->gpio_bank[id].gc.fwnode = child;
 		pctrl->gpio_bank[id].gc.label = devm_kasprintf(dev, GFP_KERNEL, "%pfw", child);
+		if (!pctrl->gpio_bank[id].gc.label)
+			return -ENOMEM;
+
 		pctrl->gpio_bank[id].gc.dbg_show = npcmgpio_dbg_show;
 		pctrl->gpio_bank[id].direction_input = pctrl->gpio_bank[id].gc.direction_input;
 		pctrl->gpio_bank[id].gc.direction_input = npcmgpio_direction_input;
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ