From: "Colin King (gmail)" <colin.i.king@gmail.com>
To: Michael Krufky <mkrufky@linuxtv.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"mailing list: linux-media" <linux-media@vger.kernel.org>
Subject: shift/mask issue in drivers/media/dvb/dvb-usb/mxl111sf-demod.c
Date: Tue, 15 Oct 2024 00:21:23 +0100 [thread overview]
Message-ID: <63c91051-3cad-409f-a1d5-ee8ed89e4de1@gmail.com> (raw)
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
reply other threads:[~2024-10-14 23:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=63c91051-3cad-409f-a1d5-ee8ed89e4de1@gmail.com \
--to=colin.i.king@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=mkrufky@linuxtv.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®