From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Subject: [patch -next] drm: dereferencing before checking for null Date: Fri, 7 May 2010 10:41:00 +0200 Message-ID: <20100507084100.GA27064@bicker> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.sourceforge.net To: David Airlie Cc: Dave Airlie , dri-devel@lists.sourceforge.net, Clemens Ladisch , Jesse Barnes List-Id: dri-devel@lists.freedesktop.org The original code dereferences "fb_helper_conn" before verifying that it's non-null. Signed-off-by: Dan Carpenter --- It's never null here actually. I could send a patch to remove the check instead if that's prefered. diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index b28e563..f5fe3a9 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -96,11 +96,12 @@ static bool drm_fb_helper_connector_parse_command_line(struct drm_fb_helper_conn int i; enum drm_connector_force force = DRM_FORCE_UNSPECIFIED; struct drm_fb_helper_cmdline_mode *cmdline_mode; - struct drm_connector *connector = fb_helper_conn->connector; + struct drm_connector *connector; if (!fb_helper_conn) return false; + connector = fb_helper_conn->connector; cmdline_mode = &fb_helper_conn->cmdline_mode; if (!mode_option) mode_option = fb_mode_option; ------------------------------------------------------------------------------ --