linux_dsm_epyc7002/drivers/media
Arnd Bergmann a398e04363 media: s3c-camif: fix out-of-bounds array access
While experimenting with older compiler versions, I ran
into a warning that no longer shows up on gcc-4.8 or newer:

drivers/media/platform/s3c-camif/camif-capture.c: In function '__camif_subdev_try_format':
drivers/media/platform/s3c-camif/camif-capture.c:1265:25: error: array subscript is below array bounds

This is an off-by-one bug, leading to an access before the start of the
array, while newer compilers silently assume this undefined behavior
cannot happen and leave the loop at index 0 if no other entry matches.

As Sylvester explains, we actually need to ensure that the
value is within the range, so this reworks the loop to be
easier to parse correctly, and an additional check to fall
back on the first format value for any unexpected input.

I found an existing gcc bug for it and added a reduced version
of the function there.

Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69249#c3
Fixes: babde1c243 ("[media] V4L: Add driver for S3C24XX/S3C64XX SoC series camera interface")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2018-03-06 07:29:04 -05:00
..
cec media: cec: improve debugging 2018-02-26 08:12:49 -05:00
common Merge commit 'v4.16-rc4~0' into patchwork 2018-03-05 07:39:06 -05:00
dvb-core media: dvb-core: add helper functions for I2C binding 2018-03-06 05:00:31 -05:00
dvb-frontends media: si2168: Announce frontend creation failure 2018-03-06 07:26:11 -05:00
firewire vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
i2c Merge commit 'v4.16-rc4~0' into patchwork 2018-03-05 07:39:06 -05:00
mmc media: move dvb kAPI headers to include/media 2017-12-28 13:16:01 -05:00
pci media: cx23885: Add support for new Hauppauge QuadHD (885) 2018-03-06 06:04:36 -05:00
platform media: s3c-camif: fix out-of-bounds array access 2018-03-06 07:29:04 -05:00
radio media: add SPDX license info 2018-02-14 13:17:03 -05:00
rc media: rc: fix race condition in ir_raw_event_store_edge() handling 2018-02-27 08:16:09 -05:00
spi
tuners media: replace all <spaces><tab> occurrences 2018-01-04 13:15:05 -05:00
usb media: cx231xx: Add second i2c demod client 2018-03-06 07:08:09 -05:00
v4l2-core Merge commit 'v4.16-rc4~0' into patchwork 2018-03-05 07:39:06 -05:00
Kconfig media: dvb: fix DVB_MMAP dependency 2018-02-23 05:21:41 -05:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
media-device.c media: zero reservedX fields in media_v2_topology 2018-02-26 09:47:53 -05:00
media-devnode.c vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
media-entity.c media: media.h: reorganize header to make it easier to understand 2018-02-26 10:14:46 -05:00