ed638b1d6f
As warned by smatch: drivers/media/pci/ivtv/ivtv-i2c.c:245 ivtv_i2c_register() error: buffer overflow 'hw_devicenames' 21 <= 31 drivers/media/pci/ivtv/ivtv-i2c.c:266 ivtv_i2c_register() error: buffer overflow 'hw_addrs' 21 <= 31 drivers/media/pci/ivtv/ivtv-i2c.c:269 ivtv_i2c_register() error: buffer overflow 'hw_addrs' 21 <= 31 drivers/media/pci/ivtv/ivtv-i2c.c:275 ivtv_i2c_register() error: buffer overflow 'hw_addrs' 21 <= 31 drivers/media/pci/ivtv/ivtv-i2c.c:280 ivtv_i2c_register() error: buffer overflow 'hw_addrs' 21 <= 31 drivers/media/pci/ivtv/ivtv-i2c.c:290 ivtv_i2c_register() error: buffer overflow 'hw_addrs' 21 <= 31 The logic at ivtv_i2c_register() could let buffer overflows at hw_devicenames and hw_addrs arrays. This won't happen in practice due to a carefully-contructed logic, but it is not error-prune. Change the logic in a way that will make clearer that the I2C hardware flags will affect the size of those two arrays, and add an explicit check to avoid buffer overflows. While here, use the bit macro. Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
||
---|---|---|
.. | ||
Kconfig | ||
Makefile | ||
ivtv-alsa-main.c | ||
ivtv-alsa-pcm.c | ||
ivtv-alsa-pcm.h | ||
ivtv-alsa.h | ||
ivtv-cards.c | ||
ivtv-cards.h | ||
ivtv-controls.c | ||
ivtv-controls.h | ||
ivtv-driver.c | ||
ivtv-driver.h | ||
ivtv-fileops.c | ||
ivtv-fileops.h | ||
ivtv-firmware.c | ||
ivtv-firmware.h | ||
ivtv-gpio.c | ||
ivtv-gpio.h | ||
ivtv-i2c.c | ||
ivtv-i2c.h | ||
ivtv-ioctl.c | ||
ivtv-ioctl.h | ||
ivtv-irq.c | ||
ivtv-irq.h | ||
ivtv-mailbox.c | ||
ivtv-mailbox.h | ||
ivtv-queue.c | ||
ivtv-queue.h | ||
ivtv-routing.c | ||
ivtv-routing.h | ||
ivtv-streams.c | ||
ivtv-streams.h | ||
ivtv-udma.c | ||
ivtv-udma.h | ||
ivtv-vbi.c | ||
ivtv-vbi.h | ||
ivtv-version.h | ||
ivtv-yuv.c | ||
ivtv-yuv.h | ||
ivtvfb.c |