* [patch -next] V4L: au0828: move dereference below sanity checks
@ 2010-07-23 10:09 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2010-07-23 10:09 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Laurent Pinchart, Devin Heitmueller, Greg Kroah-Hartman,
Hans Verkuil, linux-media, kernel-janitors
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;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [patch -next] V4L: au0828: move dereference below sanity checks
@ 2010-07-23 10:09 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2010-07-23 10:09 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Laurent Pinchart, Devin Heitmueller, Greg Kroah-Hartman,
Hans Verkuil, linux-media, kernel-janitors
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;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [patch -next] V4L: au0828: move dereference below sanity checks
2010-07-23 10:09 ` Dan Carpenter
@ 2010-07-23 13:12 ` Devin Heitmueller
-1 siblings, 0 replies; 4+ messages in thread
From: Devin Heitmueller @ 2010-07-23 13:12 UTC (permalink / raw)
To: Dan Carpenter
Cc: Mauro Carvalho Chehab, Laurent Pinchart, Greg Kroah-Hartman,
Hans Verkuil, linux-media, kernel-janitors
On Fri, Jul 23, 2010 at 6:09 AM, Dan Carpenter <error27@gmail.com> wrote:
> 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;
>
>
In reality the check for "dev" can be removed since it will *never*
happen (I added it during some debugging, as can be seen by the rest
of the NULL checks).
Either way though, this patch is fine.
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
--
Devin J. Heitmueller - Kernel Labs
http://www.kernellabs.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch -next] V4L: au0828: move dereference below sanity checks
@ 2010-07-23 13:12 ` Devin Heitmueller
0 siblings, 0 replies; 4+ messages in thread
From: Devin Heitmueller @ 2010-07-23 13:12 UTC (permalink / raw)
To: Dan Carpenter
Cc: Mauro Carvalho Chehab, Laurent Pinchart, Greg Kroah-Hartman,
Hans Verkuil, linux-media, kernel-janitors
On Fri, Jul 23, 2010 at 6:09 AM, Dan Carpenter <error27@gmail.com> wrote:
> 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;
>
>
In reality the check for "dev" can be removed since it will *never*
happen (I added it during some debugging, as can be seen by the rest
of the NULL checks).
Either way though, this patch is fine.
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
--
Devin J. Heitmueller - Kernel Labs
http://www.kernellabs.com
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-07-23 13:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-23 10:09 [patch -next] V4L: au0828: move dereference below sanity checks Dan Carpenter
2010-07-23 10:09 ` Dan Carpenter
2010-07-23 13:12 ` Devin Heitmueller
2010-07-23 13:12 ` Devin Heitmueller
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.