diff mbox

zoran: invalid test on unsigned

Message ID 49F48183.50302@gmail.com (mailing list archive)
State Superseded
Headers show

Commit Message

Roel Kluin April 26, 2009, 3:45 p.m. UTC
fmt->index is unsigned. test doesn't work

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
Is there another test required?

--
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

Comments

Trent Piepho April 26, 2009, 6:35 p.m. UTC | #1
On Sun, 26 Apr 2009, Roel Kluin wrote:
> fmt->index is unsigned. test doesn't work
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> Is there another test required?

This is an old driver and I think back in v4l1 the indexes weren't all
unsigned.  There were a number of tests like this in it.  Patch is fine.

Acked-by: Trent Piepho <xyzzy@speakeasy.org>

>
> diff --git a/drivers/media/video/zoran/zoran_driver.c b/drivers/media/video/zoran/zoran_driver.c
> index 092333b..0db5d0f 100644
> --- a/drivers/media/video/zoran/zoran_driver.c
> +++ b/drivers/media/video/zoran/zoran_driver.c
> @@ -1871,7 +1871,7 @@ static int zoran_enum_fmt(struct zoran *zr, struct v4l2_fmtdesc *fmt, int flag)
>  		if (num == fmt->index)
>  			break;
>  	}
> -	if (fmt->index < 0 /* late, but not too late */  || i == NUM_FORMATS)
> +	if (i == NUM_FORMATS)
>  		return -EINVAL;
>
>  	strncpy(fmt->description, zoran_formats[i].name, sizeof(fmt->description)-1);
> --
> 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
>
--
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
Alan Cox April 27, 2009, 3:52 p.m. UTC | #2
On Sun, 26 Apr 2009 17:45:07 +0200
Roel Kluin <roel.kluin@gmail.com> wrote:

> fmt->index is unsigned. test doesn't work
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> Is there another test required?
> 
> diff --git a/drivers/media/video/zoran/zoran_driver.c b/drivers/media/video/zoran/zoran_driver.c
> index 092333b..0db5d0f 100644
> --- a/drivers/media/video/zoran/zoran_driver.c
> +++ b/drivers/media/video/zoran/zoran_driver.c
> @@ -1871,7 +1871,7 @@ static int zoran_enum_fmt(struct zoran *zr, struct v4l2_fmtdesc *fmt, int flag)
>  		if (num == fmt->index)
>  			break;
>  	}
> -	if (fmt->index < 0 /* late, but not too late */  || i == NUM_FORMATS)
> +	if (i == NUM_FORMATS)
>  		return -EINVAL;

If it's unsigned then don't we need i >= NUM_FORMATS ?
--
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 mbox

Patch

diff --git a/drivers/media/video/zoran/zoran_driver.c b/drivers/media/video/zoran/zoran_driver.c
index 092333b..0db5d0f 100644
--- a/drivers/media/video/zoran/zoran_driver.c
+++ b/drivers/media/video/zoran/zoran_driver.c
@@ -1871,7 +1871,7 @@  static int zoran_enum_fmt(struct zoran *zr, struct v4l2_fmtdesc *fmt, int flag)
 		if (num == fmt->index)
 			break;
 	}
-	if (fmt->index < 0 /* late, but not too late */  || i == NUM_FORMATS)
+	if (i == NUM_FORMATS)
 		return -EINVAL;
 
 	strncpy(fmt->description, zoran_formats[i].name, sizeof(fmt->description)-1);