dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Moriarty <joe.moriarty@oracle.com>
To: airlied@linux.ie, dri-devel@lists.freedesktop.org
Subject: [PATCH v3 2/2] drm: NULL pointer dereference [null-pointer-deref] (CWE 476) problem
Date: Tue, 20 Feb 2018 14:11:57 -0500	[thread overview]
Message-ID: <20180220191157.100960-3-joe.moriarty@oracle.com> (raw)
In-Reply-To: <20180220191157.100960-1-joe.moriarty@oracle.com>

The Parfait (version 2.1.0) static code analysis tool found the
following NULL pointer dereference problem.

- drivers/gpu/drm/drm_drv.c
Any calls to drm_minor_get_slot() could result in the return of a NULL
pointer when an invalid DRM device type is encountered.  The
return of NULL was removed with BUG() from drm_minor_get_slot().

Signed-off-by: Joe Moriarty <joe.moriarty@oracle.com>
Reviewed-by: Steven Sistare <steven.sistare@oracle.com>
---
 drivers/gpu/drm/drm_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 9acc1e157813..a1b9338736e3 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -99,7 +99,7 @@ static struct drm_minor **drm_minor_get_slot(struct drm_device *dev,
 	case DRM_MINOR_CONTROL:
 		return &dev->control;
 	default:
-		return NULL;
+		BUG();
 	}
 }
 
-- 
2.15.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2018-02-20 19:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-20 19:11 [PATCH v3 0/2] Parfait changes Joe Moriarty
2018-02-20 19:11 ` [PATCH v3 1/2] drm: NULL pointer dereference [null-pointer-deref] (CWE 476) problem Joe Moriarty
2018-02-20 19:11 ` Joe Moriarty [this message]
2018-03-05 16:14 ` [PATCH v3 0/2] Parfait changes Joe Moriarty
2018-03-06  7:14   ` Daniel Vetter

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=20180220191157.100960-3-joe.moriarty@oracle.com \
    --to=joe.moriarty@oracle.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.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