From: Joe Moriarty Date: Tue, 20 Feb 2018 19:11:57 +0000 (-0500) Subject: drm: NULL pointer dereference [null-pointer-deref] (CWE 476) problem X-Git-Tag: v4.17-rc1~185^2~16^2~29 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3bd07ccd27622d598fd9d87f3032dd457ad62083;p=thirdparty%2Fkernel%2Flinux.git drm: NULL pointer dereference [null-pointer-deref] (CWE 476) problem 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 Reviewed-by: Steven Sistare Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20180220191157.100960-3-joe.moriarty@oracle.com --- diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 9acc1e1578138..a1b9338736e3b 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(); } }