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 media: ivtv: Drop superfluous ioctl PCM ops 2019-12-13 09:33:16 +01:00
ivtv-alsa-pcm.h
ivtv-alsa.h
ivtv-cards.c media: ivtv: Replace http links with https ones 2020-07-19 14:00:32 +02:00
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 media: pci: ivtv: convert to i2c_new_scanned_device 2020-01-08 14:33:04 +01:00
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 media: use the BIT() macro 2019-08-26 14:08:50 -03:00
ivtv-mailbox.c media: remove include stdarg.h from some drivers 2019-08-26 14:01:44 -03:00
ivtv-mailbox.h
ivtv-queue.c
ivtv-queue.h
ivtv-routing.c
ivtv-routing.h
ivtv-streams.c media: media/pci: rename VFL_TYPE_GRABBER to _VIDEO 2020-02-24 16:53:50 +01:00
ivtv-streams.h
ivtv-udma.c ivtv: convert get_user_pages() --> pin_user_pages() 2020-06-02 10:59:08 -07:00
ivtv-udma.h
ivtv-vbi.c media: media/pci/ivtv: Variable vbi.type could be uninitialized if macro v4l2_subdev_call set __result an error code 2019-10-10 07:15:09 -03:00
ivtv-vbi.h
ivtv-version.h
ivtv-yuv.c ivtv: convert get_user_pages() --> pin_user_pages() 2020-06-02 10:59:08 -07:00
ivtv-yuv.h
ivtvfb.c ivtv: convert get_user_pages() --> pin_user_pages() 2020-06-02 10:59:08 -07:00