[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADLLry5WHSTyWzRa0bg0Dsnm8rO-cVF=i1CkzKN+DMXv9wq-Xw@mail.gmail.com>
Date: Thu, 5 Sep 2019 07:39:53 +0900
From: Austin Kim <austindh.kim@...il.com>
To: Greg KH <gregkh@...uxfoundation.org>
Cc: mchehab@...nel.org, khilman@...libre.com, mjourdan@...libre.com,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
linux-amlogic@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, linux-media@...r.kernel.org
Subject: Re: [PATCH] media: meson: Add NULL check after the call to kmalloc()
2019년 9월 4일 (수) 오후 5:45, Greg KH <gregkh@...uxfoundation.org>님이 작성:
>
> On Wed, Sep 04, 2019 at 05:22:32PM +0900, Austin Kim wrote:
> > If the kmalloc() return NULL, the NULL pointer dereference will occur.
> > new_ts->ts = ts;
> >
> > Add exception check after the call to kmalloc() is made.
> >
> > Signed-off-by: Austin Kim <austindh.kim@...il.com>
> > ---
> > drivers/staging/media/meson/vdec/vdec_helpers.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.c b/drivers/staging/media/meson/vdec/vdec_helpers.c
> > index f16948b..e7e56d5 100644
> > --- a/drivers/staging/media/meson/vdec/vdec_helpers.c
> > +++ b/drivers/staging/media/meson/vdec/vdec_helpers.c
> > @@ -206,6 +206,10 @@ void amvdec_add_ts_reorder(struct amvdec_session *sess, u64 ts, u32 offset)
> > unsigned long flags;
> >
> > new_ts = kmalloc(sizeof(*new_ts), GFP_KERNEL);
> > + if (!new_ts) {
> > + dev_err(sess->core->dev, "Failed to kmalloc()\n");
>
> Did you run this through checkpatch? I think it will say that this line
> is not ok.
>
> > + return;
>
> Shouldn't you return an -ENOMEM error somehow?
I agreed with your feedback.
Let me take a look at the code more and then resend the patch if necessary.
Thanks,
Austin Kim
>
> thanks,
>
> greg k-h
Powered by blists - more mailing lists