V4L/DVB: ivtv: sizeof() => ARRAY_SIZE()

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Thursday, May 20, 2010 - 11:03 am

Gitweb:     http://git.kernel.org/linus/d72d7c1df98628315298102dd1d442bcf24dc44c
Commit:     d72d7c1df98628315298102dd1d442bcf24dc44c
Parent:     7a02264ca9ec5409e22b9d41f32b431d08eadbce
Author:     Dan Carpenter <error27@gmail.com>
AuthorDate: Wed Mar 17 12:11:56 2010 -0300
Committer:  Mauro Carvalho Chehab <mchehab@redhat.com>
CommitDate: Tue May 18 00:50:26 2010 -0300

    V4L/DVB: ivtv: sizeof() => ARRAY_SIZE()
    
    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>
    Reviewed-by: Andy Walls <awalls@radix.net>
    Signed-off-by: Andy Walls <awalls@radix.net>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
---
 drivers/media/video/ivtv/ivtv-vbi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

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);
 	}
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
V4L/DVB: ivtv: sizeof() => ARRAY_SIZE(), Linux Kernel Mailing ..., (Thu May 20, 11:03 am)