diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2013-11-22 02:51:47 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2013-12-10 12:36:11 -0500 |
commit | e351bf25fa373a3de0be2141b962c5c3c27006a2 (patch) | |
tree | 5d2fd02808c2a0c962afe35363da2e71b13b4d91 /drivers/media/pci/cx18 | |
parent | eda9dfd6752e58c5c075076654007311da6b5268 (diff) |
[media] cx18: check for allocation failure in cx18_read_eeprom()
It upsets static checkers when we don't check for allocation failure. I
moved the memset() of "tv" earlier so we don't use uninitialized data on
error.
Fixes: 1d212cf0c2d8 ('[media] cx18: struct i2c_client is too big for stack')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/pci/cx18')
-rw-r--r-- | drivers/media/pci/cx18/cx18-driver.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/media/pci/cx18/cx18-driver.c b/drivers/media/pci/cx18/cx18-driver.c index c1f8cc6f14b2..716bdc57fac6 100644 --- a/drivers/media/pci/cx18/cx18-driver.c +++ b/drivers/media/pci/cx18/cx18-driver.c | |||
@@ -327,13 +327,16 @@ void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv) | |||
327 | struct i2c_client *c; | 327 | struct i2c_client *c; |
328 | u8 eedata[256]; | 328 | u8 eedata[256]; |
329 | 329 | ||
330 | memset(tv, 0, sizeof(*tv)); | ||
331 | |||
330 | c = kzalloc(sizeof(*c), GFP_KERNEL); | 332 | c = kzalloc(sizeof(*c), GFP_KERNEL); |
333 | if (!c) | ||
334 | return; | ||
331 | 335 | ||
332 | strlcpy(c->name, "cx18 tveeprom tmp", sizeof(c->name)); | 336 | strlcpy(c->name, "cx18 tveeprom tmp", sizeof(c->name)); |
333 | c->adapter = &cx->i2c_adap[0]; | 337 | c->adapter = &cx->i2c_adap[0]; |
334 | c->addr = 0xa0 >> 1; | 338 | c->addr = 0xa0 >> 1; |
335 | 339 | ||
336 | memset(tv, 0, sizeof(*tv)); | ||
337 | if (tveeprom_read(c, eedata, sizeof(eedata))) | 340 | if (tveeprom_read(c, eedata, sizeof(eedata))) |
338 | goto ret; | 341 | goto ret; |
339 | 342 | ||