mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Colin King (gmail)" <colin.i.king@gmail.com>
To: Arend van Spriel <arend.vanspriel@broadcom.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	brcm80211@lists.linux.dev, brcm80211-dev-list.pdl@broadcom.com
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: incorrect shift and mask operation in drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c
Date: Tue, 15 Oct 2024 00:02:00 +0100	[thread overview]
Message-ID: <9c02683d-c688-4e39-913e-6b20b3bd76a0@gmail.com> (raw)

Hi,

Static analysis on 
drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c has found 
an issue with a mask and shift operation in function 
wlc_phy_rxcal_radio_setup_nphy() as follows:

lines 26326-26330:

         offtune_val =
                 (pi->tx_rx_cal_radio_saveregs
                  [2] & 0xF0) >> 8;
         offtune_val =
                 (offtune_val <= 0x7) ? 0xF : 0;

and similar in lines 26376-26381 too.

The issue is that the expression pi->tx_rx_cal_radio_saveregs[2] & 0xF0
when shifted 8 places right is always zero, so this looks like a mistake 
since some value value between 0..0xf is expected in the second statement.

Since pi->tx_rx_cal_radio_saveregs[2] is a u16 value the expression 
could plausible be:

	(pi->tx_rx_cal_radio_saveregs[2] & 0xf0) >> 4
or
	(pi->tx_rx_cal_radio_saveregs[2] & 0xf00) >> 8

I don't have knowledge of the hardware so I'm not sure what a suitable 
fix is.

Regards,

Colin


             reply	other threads:[~2024-10-14 23:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-14 23:02 Colin King (gmail) [this message]
2024-10-30 11:08 ` Arend van Spriel

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=9c02683d-c688-4e39-913e-6b20b3bd76a0@gmail.com \
    --to=colin.i.king@gmail.com \
    --cc=arend.vanspriel@broadcom.com \
    --cc=brcm80211-dev-list.pdl@broadcom.com \
    --cc=brcm80211@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.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®