Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1702348

[PATCH] drm/fb: Fix pointer dereference before null check.

From David Lechner <david@lechnology.com>
Newsgroups linux.kernel
Subject [PATCH] drm/fb: Fix pointer dereference before null check.
Date 2017-08-02 20:10 +0200
Message-ID <ua6fL-4Ya-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


fb_crtc is used before a null check, so move the use after the null check.

This was just identified by inspection. I haven't actually observed a crash
here, so it is possible that the null check could be unnecessary.

Signed-off-by: David Lechner <david@lechnology.com>
---
 drivers/gpu/drm/drm_fb_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 2cc28f0..2d3f93e 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -2424,9 +2424,9 @@ static void drm_setup_crtcs(struct drm_fb_helper *fb_helper,
 		struct drm_display_mode *mode = modes[i];
 		struct drm_fb_helper_crtc *fb_crtc = crtcs[i];
 		struct drm_fb_offset *offset = &offsets[i];
-		struct drm_mode_set *modeset = &fb_crtc->mode_set;
 
 		if (mode && fb_crtc) {
+			struct drm_mode_set *modeset = &fb_crtc->mode_set;
 			struct drm_connector *connector =
 				fb_helper->connector_info[i]->connector;
 
-- 
2.7.4

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] drm/fb: Fix pointer dereference before null check. David Lechner <david@lechnology.com> - 2017-08-02 20:10 +0200
  Re: [PATCH] drm/fb: Fix pointer dereference before null check. Daniel Vetter <daniel@ffwll.ch> - 2017-08-03 12:20 +0200

csiph-web