From patchwork Fri Aug 27 21:07:19 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 138561 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o7RL7sk3016756 for ; Fri, 27 Aug 2010 21:08:01 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752869Ab0H0VHw (ORCPT ); Fri, 27 Aug 2010 17:07:52 -0400 Received: from smtp.outflux.net ([198.145.64.163]:41947 "EHLO smtp.outflux.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751973Ab0H0VHu (ORCPT ); Fri, 27 Aug 2010 17:07:50 -0400 Received: from www.outflux.net (serenity-end.outflux.net [10.2.0.2]) by vinyl.outflux.net (8.14.3/8.14.3/Debian-9.1ubuntu1) with ESMTP id o7RL7KM9021922; Fri, 27 Aug 2010 14:07:20 -0700 Date: Fri, 27 Aug 2010 14:07:19 -0700 From: Kees Cook To: linux-kernel@vger.kernel.org Cc: Dave Airlie , Jesse Barnes , Clemens Ladisch , Mauro Carvalho Chehab , Devin Heitmueller , Laurent Pinchart , Hans Verkuil , dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org Subject: [PATCH] drm, video: fix use-before-NULL-check Message-ID: <20100827210719.GD4703@outflux.net> MIME-Version: 1.0 Content-Disposition: inline Organization: Canonical X-MIMEDefang-Filter: outflux$Revision: 1.316 $ X-HELO: www.outflux.net X-Scanned-By: MIMEDefang 2.67 on 10.2.0.1 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Fri, 27 Aug 2010 21:08:01 +0000 (UTC) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index de82e20..8dd7e6f 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -94,10 +94,11 @@ 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) diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 7b9ec6e..95a4b60 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -277,12 +277,13 @@ static void em28xx_copy_vbi(struct em28xx *dev, { void *startwrite, *startread; int offset; - int bytesperline = dev->vbi_width; + int bytesperline; if (dev == NULL) { em28xx_isocdbg("dev is null\n"); return; } + bytesperline = dev->vbi_width; if (dma_q == NULL) { em28xx_isocdbg("dma_q is null\n");