All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Devin Heitmueller <dheitmueller@kernellabs.com>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	Hans Verkuil <hverkuil@xs4all.nl>,
	linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch -next] V4L: au0828: move dereference below sanity checks
Date: Fri, 23 Jul 2010 10:09:20 +0000	[thread overview]
Message-ID: <20100723100920.GC26313@bicker> (raw)

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 <error27@gmail.com>

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;
 

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com>
To: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Devin Heitmueller <dheitmueller@kernellabs.com>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	Hans Verkuil <hverkuil@xs4all.nl>,
	linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch -next] V4L: au0828: move dereference below sanity checks
Date: Fri, 23 Jul 2010 12:09:20 +0200	[thread overview]
Message-ID: <20100723100920.GC26313@bicker> (raw)

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 <error27@gmail.com>

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;
 

             reply	other threads:[~2010-07-23 10:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-23 10:09 Dan Carpenter [this message]
2010-07-23 10:09 ` [patch -next] V4L: au0828: move dereference below sanity checks Dan Carpenter
2010-07-23 13:12 ` Devin Heitmueller
2010-07-23 13:12   ` Devin Heitmueller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100723100920.GC26313@bicker \
    --to=error27@gmail.com \
    --cc=dheitmueller@kernellabs.com \
    --cc=gregkh@suse.de \
    --cc=hverkuil@xs4all.nl \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.