linux-stable/drivers/media/cec
Dan Carpenter 8ca0e780b4 media: cec: silence shift wrapping warning in __cec_s_log_addrs()
[ Upstream commit 3b5af3171e ]

The log_addrs->log_addr_type[i] value is a u8 which is controlled by
the user and comes from the ioctl.  If it's over 31 then that results in
undefined behavior (shift wrapping) and that leads to a Smatch static
checker warning.  We already cap the value later so we can silence the
warning just by re-ordering the existing checks.

I think the UBSan checker will also catch this bug at runtime and
generate a warning.  But otherwise the bug is harmless.

Fixes: 9881fe0ca1 ("[media] cec: add HDMI CEC framework (adapter)")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-06-22 09:31:02 +02:00
..
cec-adap.c media: cec: silence shift wrapping warning in __cec_s_log_addrs() 2020-06-22 09:31:02 +02:00
cec-api.c media: cec: move check from cec_transmit to cec_transmit_msg_fh 2019-05-23 05:31:35 -04:00
cec-core.c media: cec: add struct cec_connector_info support 2019-06-27 07:18:43 -04:00
cec-notifier.c media: cec-notifier: clear cec_adap in cec_notifier_unregister 2019-08-26 06:30:32 -03:00
cec-pin-error-inj.c media: cec-pin-error-inj: avoid a false-positive Spectre detection 2018-05-28 16:11:17 -04:00
cec-pin-priv.h media: cec: improve CEC pin event handling 2018-03-22 08:16:52 -04:00
cec-pin.c media: cec-pin: fix broken tx_ignore_nack_until_eom error injection 2018-11-23 05:48:44 -05:00
cec-priv.h media: cec: add CEC_MSG_FL_RAW flag and msg_is_raw helper function 2019-05-23 05:32:40 -04:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile media: cec: remove cec-edid.c 2018-09-24 09:11:06 -04:00