From: Dimitri Sivanich <sivanich@sgi.com>
To: Colin King <colin.king@canonical.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sgi-gru: fix null pointer dereference on failed kzalloc
Date: Wed, 20 May 2015 20:51:09 -0500 [thread overview]
Message-ID: <20150521015109.GA31898@sgi.com> (raw)
In-Reply-To: <1431505186-22628-1-git-send-email-colin.king@canonical.com>
Acked-by: Dimitri Sivanich <sivanich@sgi.com>
On Wed, May 13, 2015 at 09:19:46AM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> static analysis from smatch found a potential null dereference:
>
> drivers/misc/sgi-gru/grutlbpurge.c:320 gru_register_mmu_notifier() error:
> potential null dereference 'gms'. (kzalloc returns null)
>
> bail out with -ENOMEM rather than falling through and printing a debug
> message that trips a null dereference.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/misc/sgi-gru/grutlbpurge.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/misc/sgi-gru/grutlbpurge.c b/drivers/misc/sgi-gru/grutlbpurge.c
> index 2129274..1239800 100644
> --- a/drivers/misc/sgi-gru/grutlbpurge.c
> +++ b/drivers/misc/sgi-gru/grutlbpurge.c
> @@ -315,6 +315,8 @@ struct gru_mm_struct *gru_register_mmu_notifier(void)
> err = __mmu_notifier_register(&gms->ms_notifier, current->mm);
> if (err)
> goto error;
> + } else {
> + return ERR_PTR(-ENOMEM);
> }
> }
> gru_dbg(grudev, "gms %p, refcnt %d\n", gms,
> --
> 2.1.4
prev parent reply other threads:[~2015-05-21 2:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-13 8:19 [PATCH] sgi-gru: fix null pointer dereference on failed kzalloc Colin King
2015-05-21 1:51 ` Dimitri Sivanich [this message]
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=20150521015109.GA31898@sgi.com \
--to=sivanich@sgi.com \
--cc=colin.king@canonical.com \
--cc=linux-kernel@vger.kernel.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