ba9cf6b4 | 16-Oct-2024 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
media: pulse8-cec: fix data timestamp at pulse8_setup()
As pointed by Coverity, there is a hidden overflow condition there. As date is signed and u8 is unsigned, doing:
date = (data[0] << 24)
Wit
media: pulse8-cec: fix data timestamp at pulse8_setup()
As pointed by Coverity, there is a hidden overflow condition there. As date is signed and u8 is unsigned, doing:
date = (data[0] << 24)
With a value bigger than 07f will make all upper bits of date 0xffffffff. This can be demonstrated with this small code:
<code> typedef int64_t time64_t; typedef uint8_t u8;
int main(void) { u8 data[] = { 0xde ,0xad , 0xbe, 0xef }; time64_t date;
date = (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]; printf("Invalid data = 0x%08lx\n", date);
date = ((unsigned)data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]; printf("Expected data = 0x%08lx\n", date);
return 0; } </code>
Fix it by converting the upper bit calculation to unsigned.
Fixes: cea28e7a55e7 ("media: pulse8-cec: reorganize function order") Cc: stable@vger.kernel.org Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
show more ...
|
45ba1c0b | 27-Nov-2020 |
Hans Verkuil <hverkuil-cisco@xs4all.nl> |
media: pulse8-cec: add support for FW v10 and up
Starting with firmware version 10 the GET/SET_HDMI_VERSION message was removed and GET/SET_AUTO_POWER_ON was added.
The removal of GET/SET_HDMI_VERS
media: pulse8-cec: add support for FW v10 and up
Starting with firmware version 10 the GET/SET_HDMI_VERSION message was removed and GET/SET_AUTO_POWER_ON was added.
The removal of GET/SET_HDMI_VERSION caused the probe of the Pulse-Eight to fail. Add a version check to handle this gracefully.
Also show (but do not set) the Auto Power On value.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reported-by: Maxime Ripard <mripard@kernel.org> Tested-by: Maxime Ripard <mripard@kernel.org> Cc: <stable@vger.kernel.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
show more ...
|