Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mfd: ene-kb3930: Fix a potential NULL pointer dereference

The off_gpios could be NULL. Add missing check in the kb3930_probe().
This is similar to the issue fixed in commit b1ba8bcb2d1f
("backlight: hx8357: Fix potential NULL pointer dereference").

This was detected by our static analysis tool.

Cc: stable@vger.kernel.org
Fixes: ede6b2d1dfc0 ("mfd: ene-kb3930: Add driver for ENE KB3930 Embedded Controller")
Suggested-by: Lee Jones <lee@kernel.org>
Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com>
Link: https://lore.kernel.org/r/20250224233736.1919739-1-chenyuan0y@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Chenyuan Yang and committed by
Lee Jones
4cdf1d2a f4242e0e

+1 -1
+1 -1
drivers/mfd/ene-kb3930.c
··· 162 162 devm_gpiod_get_array_optional(dev, "off", GPIOD_IN); 163 163 if (IS_ERR(ddata->off_gpios)) 164 164 return PTR_ERR(ddata->off_gpios); 165 - if (ddata->off_gpios->ndescs < 2) { 165 + if (ddata->off_gpios && ddata->off_gpios->ndescs < 2) { 166 166 dev_err(dev, "invalid off-gpios property\n"); 167 167 return -EINVAL; 168 168 }