Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752106AbdHCKMi (ORCPT ); Thu, 3 Aug 2017 06:12:38 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:38241 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751773AbdHCKMh (ORCPT ); Thu, 3 Aug 2017 06:12:37 -0400 Date: Thu, 3 Aug 2017 12:12:33 +0200 From: Daniel Vetter To: David Lechner Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Daniel Vetter Subject: Re: [PATCH] drm/fb: Fix pointer dereference before null check. Message-ID: <20170803101233.ps5lgtocr3hlb4sf@phenom.ffwll.local> Mail-Followup-To: David Lechner , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Daniel Vetter References: <1501696813-8807-1-git-send-email-david@lechnology.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1501696813-8807-1-git-send-email-david@lechnology.com> X-Operating-System: Linux phenom 4.11.0-2-amd64 User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1398 Lines: 42 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 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