All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/fb: Fix pointer dereference before null check.
@ 2017-08-02 18:00 David Lechner
  2017-08-03 10:12 ` Daniel Vetter
  0 siblings, 1 reply; 2+ messages in thread
From: David Lechner @ 2017-08-02 18:00 UTC (permalink / raw)
  To: dri-devel
  Cc: David Lechner, Daniel Vetter, Jani Nikula, Sean Paul,
	David Airlie, linux-kernel

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/fb: Fix pointer dereference before null check.
  2017-08-02 18:00 [PATCH] drm/fb: Fix pointer dereference before null check David Lechner
@ 2017-08-03 10:12 ` Daniel Vetter
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2017-08-03 10:12 UTC (permalink / raw)
  To: David Lechner; +Cc: dri-devel, linux-kernel, Daniel Vetter

On Wed, Aug 02, 2017 at 01:00:13PM -0500, David Lechner wrote:
> 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>

Thanks, applied.
-Daniel

> ---
>  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
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-08-03 10:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-02 18:00 [PATCH] drm/fb: Fix pointer dereference before null check David Lechner
2017-08-03 10:12 ` Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.