OpenCloudOS-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 media: don't include drivers/media/i2c at cflags 2017-12-28 14:14:09 -05:00
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 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
ivtv-alsa.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
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 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
ivtv-controls.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
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 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
ivtv-fileops.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
ivtv-firmware.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
ivtv-firmware.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
ivtv-gpio.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
ivtv-gpio.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
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 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
ivtv-irq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
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 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
ivtv-queue.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
ivtv-queue.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
ivtv-routing.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
ivtv-routing.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
ivtv-streams.c media: media/pci: rename VFL_TYPE_GRABBER to _VIDEO 2020-02-24 16:53:50 +01:00
ivtv-streams.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
ivtv-udma.c ivtv: convert get_user_pages() --> pin_user_pages() 2020-06-02 10:59:08 -07:00
ivtv-udma.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
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 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
ivtv-version.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
ivtv-yuv.c ivtv: convert get_user_pages() --> pin_user_pages() 2020-06-02 10:59:08 -07:00
ivtv-yuv.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
ivtvfb.c ivtv: convert get_user_pages() --> pin_user_pages() 2020-06-02 10:59:08 -07:00