linux/drivers/staging/wfx
Jérôme Pouiller 868fd970e1 staging: wfx: improve robustness of wfx_get_hw_rate()
Smatch complains:

    data_tx.c:37 wfx_get_hw_rate() warn: constraint '(struct ieee80211_supported_band)->bitrates' overflow 'band->bitrates' 0 <= abs_rl '0-127' user_rl '' required = '(struct ieee80211_supported_band)->n_bitrates'
    23          struct ieee80211_supported_band *band;
    24
    25          if (rate->idx < 0)
    26                  return -1;
    27          if (rate->flags & IEEE80211_TX_RC_MCS) {
    28                  if (rate->idx > 7) {
    29                          WARN(1, "wrong rate->idx value: %d", rate->idx);
    30                          return -1;
    31                  }
    32                  return rate->idx + 14;
    33          }
    34          // WFx only support 2GHz, else band information should be retrieved
    35          // from ieee80211_tx_info
    36          band = wdev->hw->wiphy->bands[NL80211_BAND_2GHZ];
    37          return band->bitrates[rate->idx].hw_value;

Add a simple check to make Smatch happy.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20201009171307.864608-9-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-10-10 12:33:59 +02:00
..
Documentation/devicetree/bindings/net/wireless dt-bindings: staging: wfx: silabs,wfx yaml conversion 2020-10-07 12:55:47 +02:00
bh.c staging: wfx: gpiod_get_value() can return an error 2020-10-10 12:33:59 +02:00
bh.h staging: wfx: update copyrights dates 2020-10-07 12:55:47 +02:00
bus_sdio.c staging: wfx: update copyrights dates 2020-10-07 12:55:47 +02:00
bus_spi.c staging: wfx: update copyrights dates 2020-10-07 12:55:47 +02:00
bus.h staging: wfx: update copyrights dates 2020-10-07 12:55:47 +02:00
data_rx.c staging: wfx: update copyrights dates 2020-10-07 12:55:47 +02:00
data_rx.h staging: wfx: update copyrights dates 2020-10-07 12:55:47 +02:00
data_tx.c staging: wfx: improve robustness of wfx_get_hw_rate() 2020-10-10 12:33:59 +02:00
data_tx.h staging: wfx: update copyrights dates 2020-10-07 12:55:47 +02:00
debug.c staging: wfx: update copyrights dates 2020-10-07 12:55:47 +02:00
debug.h staging: wfx: allow to send commands to chip 2019-10-04 10:46:10 +02:00
fwio.c staging: wfx: update copyrights dates 2020-10-07 12:55:47 +02:00
fwio.h staging: wfx: load firmware 2019-10-04 10:43:39 +02:00
hif_api_cmd.h staging: wfx: update copyrights dates 2020-10-07 12:55:47 +02:00
hif_api_general.h staging: wfx: update copyrights dates 2020-10-07 12:55:47 +02:00
hif_api_mib.h staging: wfx: update copyrights dates 2020-10-07 12:55:47 +02:00
hif_rx.c staging: wfx: drop unicode characters from strings 2020-10-10 12:33:59 +02:00
hif_rx.h staging: wfx: add support for start-up indication 2019-10-04 10:46:09 +02:00
hif_tx_mib.c staging: wfx: update copyrights dates 2020-10-07 12:55:47 +02:00
hif_tx_mib.h staging: wfx: update copyrights dates 2020-10-07 12:55:47 +02:00
hif_tx.c staging: wfx: improve error handling of hif_join() 2020-10-10 12:33:58 +02:00
hif_tx.h staging: wfx: update copyrights dates 2020-10-07 12:55:47 +02:00
hwio.c staging: wfx: update copyrights dates 2020-10-07 12:55:47 +02:00
hwio.h staging: wfx: update copyrights dates 2020-10-07 12:55:47 +02:00
Kconfig staging: wfx: fix CONFIG_MMC=m with CONFIG_WFX=y 2019-10-26 20:42:32 +02:00
key.c staging: wfx: update copyrights dates 2020-10-07 12:55:47 +02:00
key.h staging: wfx: update copyrights dates 2020-10-07 12:55:47 +02:00
main.c staging: wfx: wfx_init_common() returns NULL on error 2020-10-10 12:33:59 +02:00
main.h staging: wfx: update copyrights dates 2020-10-07 12:55:47 +02:00
Makefile staging: wfx: place hif_tx_mib functions into a .c file 2020-04-13 14:32:38 +02:00
queue.c staging: wfx: update copyrights dates 2020-10-07 12:55:47 +02:00
queue.h staging: wfx: update copyrights dates 2020-10-07 12:55:47 +02:00
scan.c staging: wfx: update copyrights dates 2020-10-07 12:55:47 +02:00
scan.h staging: wfx: update copyrights dates 2020-10-07 12:55:47 +02:00
sta.c staging: wfx: standardize the error when vif does not exist 2020-10-10 12:33:59 +02:00
sta.h staging: wfx: update copyrights dates 2020-10-07 12:55:47 +02:00
TODO staging: wfx: update TODO list 2020-09-13 09:23:06 +02:00
traces.h staging: wfx: update copyrights dates 2020-10-07 12:55:47 +02:00
wfx.h staging: wfx: update copyrights dates 2020-10-07 12:55:47 +02:00