Tom Rix e43b301cb1 media: TDA1997x: handle short reads of hdmi info frame.
[ Upstream commit 48d219f9cc667bc6fbc3e3af0b1bfd75db94fce4 ]

Static analysis reports this representative problem

tda1997x.c:1939: warning: 7th function call argument is an uninitialized
value

The 7th argument is buffer[0], which is set in the earlier call to
io_readn().  When io_readn() call to io_read() fails with the first
read, buffer[0] is not set and 0 is returned and stored in len.

The later call to hdmi_infoframe_unpack()'s size parameter is the
static size of buffer, always 40, so a short read is not caught
in hdmi_infoframe_unpacks()'s checking.  The variable len should be
used instead.

Zero initialize buffer to 0 so it is in a known start state.

Fixes: 9ac0038db9a7 ("media: i2c: Add TDA1997x HDMI receiver driver")
Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: Tim Harvey <tharvey@gateworks.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>
2021-11-18 14:04:04 +01:00
..
2019-07-09 09:47:22 -07:00
2020-12-30 11:53:24 +01:00
2020-09-07 16:13:06 +02:00
2020-07-19 14:15:42 +02:00
2020-07-19 14:15:42 +02:00
2019-03-01 09:29:58 -05:00
2020-08-29 08:35:27 +02:00
2020-09-01 14:13:27 +02:00
2020-08-29 08:35:27 +02:00
2019-08-26 14:05:09 -03:00
2019-03-01 09:29:58 -05:00
2019-03-01 09:29:58 -05:00