From patchwork Fri Jul 23 10:09:20 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 3874 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Fri, 23 Jul 2010 10:09:51 +0000 Received: from bombadil.infradead.org [18.85.46.34] by localhost with IMAP (fetchmail-6.3.17) for (single-drop); Fri, 23 Jul 2010 10:37:24 -0300 (BRT) Received: from vger.kernel.org ([209.132.180.67]) by bombadil.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1OcFCR-0000cn-8H; Fri, 23 Jul 2010 10:09:51 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755568Ab0GWKJt (ORCPT + 1 other); Fri, 23 Jul 2010 06:09:49 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:56311 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753718Ab0GWKJs (ORCPT ); Fri, 23 Jul 2010 06:09:48 -0400 Received: by mail-fx0-f46.google.com with SMTP id 14so4897840fxm.19 for ; Fri, 23 Jul 2010 03:09:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=qPwwngQZRibDnSAQGEUshl7c+v1EZ3ZQ/xI7cW5WdLU=; b=snnVlZ4ZzmeMAOunYEwnmtLPtSMdkBisC7msaJuPN/g+mL5hzJKuZIw5r7fULIuhjF 92sfzCwQSw9HmIWIv93qDRwhcM/gCuU2odtIfm0zjtmXclh+L6fyRTE32uOcQ+lzBktu hrMPovS+BD/rfN4vF7RN0/qsmDSrnxz01pXlA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=QzD2O4YAGMbl8W4EZ3WvFhSmDqPrTeoshApUVTquSpvbT8fWsvbTNJcxSXdc7VS9CY o+IuKU/zJgVVPXSuzh+VefBqWfJvlfFy3K1Odc4U9bvDLn451JNd1dTetAieiEqtfo6c u01/GNn1EGVEWhN9IyDBcRlAWyRe4tQXZG+us= Received: by 10.223.121.19 with SMTP id f19mr3061793far.73.1279879787218; Fri, 23 Jul 2010 03:09:47 -0700 (PDT) Received: from bicker ([205.177.176.130]) by mx.google.com with ESMTPS id h8sm26045faj.38.2010.07.23.03.09.31 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 23 Jul 2010 03:09:46 -0700 (PDT) Date: Fri, 23 Jul 2010 12:09:20 +0200 From: Dan Carpenter To: Mauro Carvalho Chehab Cc: Laurent Pinchart , Devin Heitmueller , Greg Kroah-Hartman , Hans Verkuil , linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch -next] V4L: au0828: move dereference below sanity checks Message-ID: <20100723100920.GC26313@bicker> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This function has sanity checks to make sure that "dev" is non-null. I moved the dereference down below the checks. In the current code "dev" is never actually null. Signed-off-by: Dan Carpenter Acked-by: Devin Heitmueller --- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/video/au0828/au0828-video.c b/drivers/media/video/au0828/au0828-video.c index d97e0a2..7989a7b 100644 --- a/drivers/media/video/au0828/au0828-video.c +++ b/drivers/media/video/au0828/au0828-video.c @@ -441,7 +441,7 @@ static void au0828_copy_vbi(struct au0828_dev *dev, unsigned char *outp, unsigned long len) { unsigned char *startwrite, *startread; - int bytesperline = dev->vbi_width; + int bytesperline; int i, j = 0; if (dev == NULL) { @@ -464,6 +464,8 @@ static void au0828_copy_vbi(struct au0828_dev *dev, return; } + bytesperline = dev->vbi_width; + if (dma_q->pos + len > buf->vb.size) len = buf->vb.size - dma_q->pos;