diff options
author | Jean Delvare <khali@linux-fr.org> | 2006-03-22 01:48:32 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-03-23 09:24:05 -0500 |
commit | 6eb5d9ca9f1496108cb86f2d9bfc2db5d9c796fe (patch) | |
tree | 1fe693708ca8aed3f4f81dfb4a5c4254b4968e28 | |
parent | 6254312352dfd1c996245cb3bc74be901dc165cc (diff) |
V4L/DVB (3568b): saa7111: Prevent array overrun
Explicitely state the number of registers the SAA7111 has, and use that
defined value where relevant. This should prevent any future array overrun
like the one I just fixed in the saa7110 driver.
This patch also saves 8 bytes of memory as a side effect, as the register
cache was larger than needed.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | drivers/media/video/saa7111.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/media/video/saa7111.c b/drivers/media/video/saa7111.c index 8c06592b37ff..a2e1ccb79e49 100644 --- a/drivers/media/video/saa7111.c +++ b/drivers/media/video/saa7111.c | |||
@@ -70,8 +70,10 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)"); | |||
70 | 70 | ||
71 | /* ----------------------------------------------------------------------- */ | 71 | /* ----------------------------------------------------------------------- */ |
72 | 72 | ||
73 | #define SAA7111_NR_REG 0x18 | ||
74 | |||
73 | struct saa7111 { | 75 | struct saa7111 { |
74 | unsigned char reg[32]; | 76 | unsigned char reg[SAA7111_NR_REG]; |
75 | 77 | ||
76 | int norm; | 78 | int norm; |
77 | int input; | 79 | int input; |
@@ -227,11 +229,11 @@ saa7111_command (struct i2c_client *client, | |||
227 | { | 229 | { |
228 | int i; | 230 | int i; |
229 | 231 | ||
230 | for (i = 0; i < 32; i += 16) { | 232 | for (i = 0; i < SAA7111_NR_REG; i += 16) { |
231 | int j; | 233 | int j; |
232 | 234 | ||
233 | printk(KERN_DEBUG "%s: %03x", I2C_NAME(client), i); | 235 | printk(KERN_DEBUG "%s: %03x", I2C_NAME(client), i); |
234 | for (j = 0; j < 16; ++j) { | 236 | for (j = 0; j < 16 && i + j < SAA7111_NR_REG; ++j) { |
235 | printk(" %02x", | 237 | printk(" %02x", |
236 | saa7111_read(client, i + j)); | 238 | saa7111_read(client, i + j)); |
237 | } | 239 | } |