* shift/mask issue in drivers/media/dvb/dvb-usb/mxl111sf-demod.c
@ 2024-10-14 23:21 Colin King (gmail)
0 siblings, 0 replies; only message in thread
From: Colin King (gmail) @ 2024-10-14 23:21 UTC (permalink / raw)
To: Michael Krufky, Mauro Carvalho Chehab
Cc: linux-kernel, mailing list: linux-media
Hi,
Static analysis has found a shift/mask issue in
drivers/media/dvb/dvb-usb/mxl111sf-demod.c in function
mxl1x1sf_demod_get_tps_hierarchy(), as described as follows:
/* bit<6:4> - 000:Non hierarchy, 001:1, 010:2, 011:4 */
if (mxl_fail(ret))
goto fail;
switch ((val & V6_TPS_HIERARCHY_INFO_MASK) >> 6) {
case 0:
*hierarchy = HIERARCHY_NONE;
break;
case 1:
*hierarchy = HIERARCHY_1;
break;
case 2:
*hierarchy = HIERARCHY_2;
break;
case 3:
*hierarchy = HIERARCHY_4;
break;
}
There are two issues. First, the comment states the bits of interest are
bits <6:4> and yet the shift is by 6 bits, I suspect that should be a 4
bit shift. Secondly, V6_TPS_HIERARCHY_INFO_MASK is defined in
drivers/media/usb/dvb-usb-v2/mxl111sf-reg.h as:
#define V6_TPS_HIERARCHY_INFO_MASK 0x40
..so only one bit is being masked, I suspect it should be (0x7 << 4) or
0x70 for the 3 bits <6:3> or maybe just (0x3 << 4) or 0x30 if we're just
interested in the bottom two bits for the case 0..3.
Anyhow, I don't have the hardware manual or hardware to test specific
fixes and I'm 100% about making a fix based on the comment w/o the
hardware to test this on.
Colin
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-10-14 23:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-14 23:21 shift/mask issue in drivers/media/dvb/dvb-usb/mxl111sf-demod.c Colin King (gmail)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®