From: Andrew Jeffery <andrew@aj.id.au>
To: linux-aspeed@lists.ozlabs.org
Subject: [PATCH] gpio: fix a potential NULL pointer dereference
Date: Sun, 24 Mar 2019 19:12:06 -0400 [thread overview]
Message-ID: <f4d27985-376a-42bb-b781-bdc96c0cef21@www.fastmail.com> (raw)
In-Reply-To: <20190324231002.2106-1-kjlu@umn.edu>
On Mon, 25 Mar 2019, at 09:40, Kangjie Lu wrote:
> 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>
> ---
> drivers/gpio/gpio-aspeed.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
> index 854bce4fb9e7..217507002dbc 100644
> --- a/drivers/gpio/gpio-aspeed.c
> +++ b/drivers/gpio/gpio-aspeed.c
> @@ -1224,6 +1224,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);
> }
> --
> 2.17.1
>
>
next prev parent reply other threads:[~2019-03-24 23:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-24 23:10 [PATCH] gpio: fix a potential NULL pointer dereference Kangjie Lu
2019-03-24 23:12 ` Andrew Jeffery [this message]
2019-03-25 8:28 ` Bartosz Golaszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f4d27985-376a-42bb-b781-bdc96c0cef21@www.fastmail.com \
--to=andrew@aj.id.au \
--cc=linux-aspeed@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox