From 4ef2ccc2611456667ea78c6f418ce87e1fa9fac5 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Wed, 28 Jan 2009 21:32:58 -0300 Subject: V4L/DVB (10558): bttv: norm value should be unsigned The norm value in the driver is an index into an array and the the driver doesn't allow it to be negative or otherwise invalid. It should be unsigned but wasn't in all places. Fix some structs and functions to have the norm be unsigned. Get rid of useless checks for "< 0". Most of the driver code can't handle a norm value that's out of range, so change some ">= BTTV_TVNORMS" checks to BUG_ON(). There's no point in silently ignoring invalid driver state just to crash because of it later. Reported-by: Roel Kluin Signed-off-by: Trent Piepho Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/bt8xx/bttvp.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'drivers/media/video/bt8xx/bttvp.h') diff --git a/drivers/media/video/bt8xx/bttvp.h b/drivers/media/video/bt8xx/bttvp.h index 199a4d225caf..230e148e78fe 100644 --- a/drivers/media/video/bt8xx/bttvp.h +++ b/drivers/media/video/bt8xx/bttvp.h @@ -135,7 +135,7 @@ struct bttv_buffer { /* bttv specific */ const struct bttv_format *fmt; - int tvnorm; + unsigned int tvnorm; int btformat; int btswap; struct bttv_geometry geo; @@ -154,7 +154,7 @@ struct bttv_buffer_set { }; struct bttv_overlay { - int tvnorm; + unsigned int tvnorm; struct v4l2_rect w; enum v4l2_field field; struct v4l2_clip *clips; @@ -174,7 +174,7 @@ struct bttv_vbi_fmt { }; /* bttv-vbi.c */ -void bttv_vbi_fmt_reset(struct bttv_vbi_fmt *f, int norm); +void bttv_vbi_fmt_reset(struct bttv_vbi_fmt *f, unsigned int norm); struct bttv_crop { /* A cropping rectangle in struct bttv_tvnorm.cropcap units. */ @@ -378,7 +378,8 @@ struct bttv { unsigned int audio; unsigned int mute; unsigned long freq; - int tvnorm,hue,contrast,bright,saturation; + unsigned int tvnorm; + int hue, contrast, bright, saturation; struct v4l2_framebuffer fbuf; unsigned int field_count; -- cgit v1.2.3