From: Daniel Vetter <daniel@ffwll.ch>
To: Eric Engestrom <eric.engestrom@imgtec.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/mm: avoid possible null pointer dereference
Date: Mon, 23 May 2016 14:56:45 +0200 [thread overview]
Message-ID: <20160523125645.GY27098@phenom.ffwll.local> (raw)
In-Reply-To: <20160523102714.GA13596@imgtec.com>
On Mon, May 23, 2016 at 11:27:14AM +0100, Eric Engestrom wrote:
> On Wed, May 18, 2016 at 10:17:19PM +0200, Heinrich Schuchardt wrote:
> > Do not dereference node before the check if node is NULL.
> >
> > Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> > ---
> > drivers/gpu/drm/drm_mm.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
> > index 04de6fd..cb39f45 100644
> > --- a/drivers/gpu/drm/drm_mm.c
> > +++ b/drivers/gpu/drm/drm_mm.c
> > @@ -179,12 +179,14 @@ static void drm_mm_insert_helper(struct drm_mm_node *hole_node,
> > int drm_mm_reserve_node(struct drm_mm *mm, struct drm_mm_node *node)
> > {
> > struct drm_mm_node *hole;
> > - u64 end = node->start + node->size;
> > + u64 end;
> > u64 hole_start;
> > u64 hole_end;
> >
> > BUG_ON(node == NULL);
> >
> > + end = node->start + node->size;
> > +
> > /* Find the relevant hole to add our node to */
> > drm_mm_for_each_hole(hole, mm, hole_start, hole_end) {
> > if (hole_start > node->start || hole_end < end)
> > --
> > 2.1.4
>
> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Applied to drm-misc, thanks.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
next prev parent reply other threads:[~2016-05-23 12:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-18 20:17 Heinrich Schuchardt
2016-05-23 10:27 ` Eric Engestrom
2016-05-23 12:56 ` Daniel Vetter [this message]
2016-05-23 13:02 ` Chris Wilson
2016-05-23 13:38 ` Eric Engestrom
2016-05-23 13:46 ` Chris Wilson
2016-05-23 15:35 ` Eric Engestrom
2016-05-23 15:50 ` Chris Wilson
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=20160523125645.GY27098@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=eric.engestrom@imgtec.com \
--cc=linux-kernel@vger.kernel.org \
--cc=xypron.glpk@gmx.de \
/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
Powered by JetHome