WSL2-Linux-Kernel/drivers/media/pci/ivtv
Mauro Carvalho Chehab ed638b1d6f media: ivtv: prevent going past the hw arrays
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>
2021-07-12 09:16:31 +02:00
..
Kconfig media: ivtv: get rid of DVB deprecated ioctls 2021-06-04 08:06:53 +02:00
Makefile
ivtv-alsa-main.c module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
ivtv-alsa-pcm.c
ivtv-alsa-pcm.h
ivtv-alsa.h
ivtv-cards.c
ivtv-cards.h media: ivtv: prevent going past the hw arrays 2021-07-12 09:16:31 +02:00
ivtv-controls.c
ivtv-controls.h
ivtv-driver.c media updates for v5.13-rc1 2021-04-28 09:24:36 -07:00
ivtv-driver.h media: ivtv: get rid of DVB deprecated ioctls 2021-06-04 08:06:53 +02:00
ivtv-fileops.c
ivtv-fileops.h
ivtv-firmware.c
ivtv-firmware.h
ivtv-gpio.c
ivtv-gpio.h
ivtv-i2c.c media: ivtv: prevent going past the hw arrays 2021-07-12 09:16:31 +02:00
ivtv-i2c.h
ivtv-ioctl.c media: ivtv: get rid of DVB deprecated ioctls 2021-06-04 08:06:53 +02:00
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