public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] ivtv: sizeof() => ARRAY_SIZE()
@ 2010-03-17 15:11 Dan Carpenter
  2010-03-18 11:37 ` Andy Walls
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-03-17 15:11 UTC (permalink / raw)
  To: Andy Walls
  Cc: Mauro Carvalho Chehab, ivtv-devel, linux-media, linux-kernel,
	kernel-janitors

This fixes a smatch warning:
drivers/media/video/ivtv/ivtv-vbi.c +138 ivtv_write_vbi(43) 
	error: buffer overflow 'vi->cc_payload' 256 <= 1023

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/media/video/ivtv/ivtv-vbi.c b/drivers/media/video/ivtv/ivtv-vbi.c
index f420d31..d73af45 100644
--- a/drivers/media/video/ivtv/ivtv-vbi.c
+++ b/drivers/media/video/ivtv/ivtv-vbi.c
@@ -134,7 +134,7 @@ void ivtv_write_vbi(struct ivtv *itv, const struct v4l2_sliced_vbi_data *sliced,
 			}
 		}
 	}
-	if (found_cc && vi->cc_payload_idx < sizeof(vi->cc_payload)) {
+	if (found_cc && vi->cc_payload_idx < ARRAY_SIZE(vi->cc_payload)) {
 		vi->cc_payload[vi->cc_payload_idx++] = cc;
 		set_bit(IVTV_F_I_UPDATE_CC, &itv->i_flags);
 	}

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] ivtv: sizeof() => ARRAY_SIZE()
  2010-03-17 15:11 [patch] ivtv: sizeof() => ARRAY_SIZE() Dan Carpenter
@ 2010-03-18 11:37 ` Andy Walls
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Walls @ 2010-03-18 11:37 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Mauro Carvalho Chehab, ivtv-devel, linux-media, linux-kernel,
	kernel-janitors

On Wed, 2010-03-17 at 18:11 +0300, Dan Carpenter wrote:
> This fixes a smatch warning:
> drivers/media/video/ivtv/ivtv-vbi.c +138 ivtv_write_vbi(43) 
> 	error: buffer overflow 'vi->cc_payload' 256 <= 1023
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Looks good.

Reviewed-by: Andy Walls <awalls@radix.net>

And, if needed

Signed-off-by: Andy Walls <awalls@radix.net>

Regards,
Andy

> diff --git a/drivers/media/video/ivtv/ivtv-vbi.c b/drivers/media/video/ivtv/ivtv-vbi.c
> index f420d31..d73af45 100644
> --- a/drivers/media/video/ivtv/ivtv-vbi.c
> +++ b/drivers/media/video/ivtv/ivtv-vbi.c
> @@ -134,7 +134,7 @@ void ivtv_write_vbi(struct ivtv *itv, const struct v4l2_sliced_vbi_data *sliced,
>  			}
>  		}
>  	}
> -	if (found_cc && vi->cc_payload_idx < sizeof(vi->cc_payload)) {
> +	if (found_cc && vi->cc_payload_idx < ARRAY_SIZE(vi->cc_payload)) {
>  		vi->cc_payload[vi->cc_payload_idx++] = cc;
>  		set_bit(IVTV_F_I_UPDATE_CC, &itv->i_flags);
>  	}
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-03-18 11:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-17 15:11 [patch] ivtv: sizeof() => ARRAY_SIZE() Dan Carpenter
2010-03-18 11:37 ` Andy Walls

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox