mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
gpio: aspeed: fix a potential NULL pointer dereference
[ Upstream commit 6cf4511e97 ]
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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
6d18191c3e
commit
ecb44816ba
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user