Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ecb44816 authored by Kangjie Lu's avatar Kangjie Lu Committed by Greg Kroah-Hartman
Browse files

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: default avatarKangjie Lu <kjlu@umn.edu>
Reviewed-by: default avatarAndrew Jeffery <andrew@aj.id.au>
Signed-off-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: default avatarSasha Levin (Microsoft) <sashal@kernel.org>
parent 6d18191c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -861,6 +861,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);
}