summaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorKangjie Lu <kjlu@umn.edu>2019-03-24 18:10:02 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-04 09:20:19 +0200
commitc87a5086d354a178fe353607a0a068e4465135f5 (patch)
tree87d31ec35739589d39f6e6ca12c3014a490d7bba /drivers/gpio
parentc5eb9a424ebd2d9f9e3cccdf2bfbb415c2921261 (diff)
downloadlinux-stable-c87a5086d354a178fe353607a0a068e4465135f5.tar.gz
linux-stable-c87a5086d354a178fe353607a0a068e4465135f5.tar.bz2
linux-stable-c87a5086d354a178fe353607a0a068e4465135f5.zip
gpio: aspeed: fix a potential NULL pointer dereference
[ Upstream commit 6cf4511e9729c00a7306cf94085f9cc3c52ee723 ] In case devm_kzalloc, the patch returns ENOMEM to avoid potential NULL pointer dereference. Signed-off-by: Kangjie Lu <kjlu@umn.edu> Reviewed-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Sasha Levin (Microsoft) <sashal@kernel.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-aspeed.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
index 2342e154029b..b696ec35efb3 100644
--- a/drivers/gpio/gpio-aspeed.c
+++ b/drivers/gpio/gpio-aspeed.c
@@ -1225,6 +1225,8 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev)
gpio->offset_timer =
devm_kzalloc(&pdev->dev, gpio->chip.ngpio, GFP_KERNEL);
+ if (!gpio->offset_timer)
+ return -ENOMEM;
return aspeed_gpio_setup_irqs(gpio, pdev);
}