dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Melissa Wen <melissa.srw@gmail.com>
To: Sumera Priyadarsini <sylphrenadin@gmail.com>
Cc: Haneen Mohammed <hamohammed.sa@gmail.com>,
	Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>,
	David Airlie <airlied@linux.ie>,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org,
	Colin King <colin.king@canonical.com>
Subject: Re: [PATCH][next] drm/vkms: Fix missing kmalloc allocation failure check
Date: Fri, 15 Jan 2021 17:58:38 -0300	[thread overview]
Message-ID: <20210115205838.7hff6mmyyl55pgek@smtp.gmail.com> (raw)
In-Reply-To: <CACAkLuqG+4cq9w9=JEjB-5KPcxu==2+Sen6GMknM495vELgEFA@mail.gmail.com>

On 01/15, Sumera Priyadarsini wrote:
> On Fri, Jan 15, 2021 at 6:39 PM Colin King <colin.king@canonical.com> wrote:
> >
> > From: Colin Ian King <colin.king@canonical.com>
> >
> > Currently the kmalloc allocation for config is not being null
> > checked and could potentially lead to a null pointer dereference.
> > Fix this by adding the missing null check.
> >
> > Addresses-Coverity: ("Dereference null return value")
> > Fixes: 2df7af93fdad ("drm/vkms: Add vkms_config type")
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> 
> Good catch, thank you!
> 
> Reviewed-by: Sumera Priyadarsini <sylphrenadin@gmail.com>

Applied to drm-misc-next.

Thanks,
Melissa Wen
> > ---
> >  drivers/gpu/drm/vkms/vkms_drv.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
> > index 708f7f54001d..2173b82606f6 100644
> > --- a/drivers/gpu/drm/vkms/vkms_drv.c
> > +++ b/drivers/gpu/drm/vkms/vkms_drv.c
> > @@ -188,7 +188,11 @@ static int vkms_create(struct vkms_config *config)
> >
> >  static int __init vkms_init(void)
> >  {
> > -       struct vkms_config *config = kmalloc(sizeof(*config), GFP_KERNEL);
> > +       struct vkms_config *config;
> > +
> > +       config = kmalloc(sizeof(*config), GFP_KERNEL);
> > +       if (!config)
> > +               return -ENOMEM;
> >
> >         default_config = config;
> >
> > --
> > 2.29.2
> >
> regards,
> Sumera
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

      reply	other threads:[~2021-01-15 20:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15 13:09 [PATCH][next] drm/vkms: Fix missing kmalloc allocation failure check Colin King
2021-01-15 14:10 ` Sumera Priyadarsini
2021-01-15 20:58   ` Melissa Wen [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=20210115205838.7hff6mmyyl55pgek@smtp.gmail.com \
    --to=melissa.srw@gmail.com \
    --cc=airlied@linux.ie \
    --cc=colin.king@canonical.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hamohammed.sa@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rodrigosiqueiramelo@gmail.com \
    --cc=sylphrenadin@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).