Linux-Wireless Archive mirror
 help / color / mirror / Atom feed
From: samasth.norway.ananda@oracle.com
To: arend.vanspriel@broadcom.com, linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org
Subject: Buffer overrun error found in brcm80211 driver code
Date: Mon, 6 May 2024 12:03:15 -0700	[thread overview]
Message-ID: <8292faa6-a2f6-4b43-8d60-9eeba85aa6b1@oracle.com> (raw)

Hi,


I came across an issue reported by an internal static analysis tool when 
tested on the code for brcm80211 driver.

The commit which introduced is -
5b435de0d786869c95d1962121af0d7df2542009
("net: wireless: add brcm80211 drivers")


In the file -
drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c

within the function wlc_lcnphy_tx_iqlo_cal()

we assign value to band_idx as below
band_idx = (CHSPEC_IS5G(pi->radio_chanspec) ? 1 : 0);
 From this band_idx could be either 1 or 0.

But when we look at the array iqcal_gainparams_numgains_lcnphy[] at
drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c

We can notice that it is initialized with only one value in it.

static const u16 iqcal_gainparams_numgains_lcnphy[1] = {
     ARRAY_SIZE(tbl_iqcal_gainparams_lcnphy_2G),
};


So, when we try to access iqcal_gainparams_numgains_lcnphy[band_idx]
within the for loop in the same function we could be reading a wrong 
value of  iqcal_gainparams_numgains_lcnphy[1]

Do you have any suggestion on how we can resolve this?
Is it possible to keep band_idx to just 0?


Thanks,
Samasth.

             reply	other threads:[~2024-05-06 19:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-06 19:03 samasth.norway.ananda [this message]
2024-05-07 19:09 ` Buffer overrun error found in brcm80211 driver code Arend van Spriel
2024-05-08 23:27   ` [External] : " samasth.norway.ananda

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=8292faa6-a2f6-4b43-8d60-9eeba85aa6b1@oracle.com \
    --to=samasth.norway.ananda@oracle.com \
    --cc=arend.vanspriel@broadcom.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).