Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] mwifiex: add a bounds check in mwifiex_process_sta_rx_packet()
@ 2019-04-02  7:03 Dan Carpenter
  2019-04-03 20:05 ` Brian Norris
  2019-04-04 10:21 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2019-04-02  7:03 UTC (permalink / raw)
  To: Amitkumar Karwar
  Cc: Nishant Sarmukadam, Ganapathi Bhat, Xinming Hu, Kalle Valo,
	linux-wireless, kernel-janitors

Smatch complains that "local_rx_pd->priority" can't be trusted because
it comes from skb->data and it can go up to 255 instead of being capped
in the 0-7 range.  A few lines earlier, on the other side of the if
statement, we cap priority so it seems harmless to add a bounds check
here as well.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/wireless/marvell/mwifiex/sta_rx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/sta_rx.c b/drivers/net/wireless/marvell/mwifiex/sta_rx.c
index fb28a5c7f441..52a2ce2e78b0 100644
--- a/drivers/net/wireless/marvell/mwifiex/sta_rx.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_rx.c
@@ -250,7 +250,8 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_private *priv,
 							     local_rx_pd->nf);
 		}
 	} else {
-		if (rx_pkt_type != PKT_TYPE_BAR)
+		if (rx_pkt_type != PKT_TYPE_BAR &&
+		    local_rx_pd->priority < MAX_NUM_TID)
 			priv->rx_seq[local_rx_pd->priority] = seq_num;
 		memcpy(ta, priv->curr_bss_params.bss_descriptor.mac_address,
 		       ETH_ALEN);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-04-04 10:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-02  7:03 [PATCH] mwifiex: add a bounds check in mwifiex_process_sta_rx_packet() Dan Carpenter
2019-04-03 20:05 ` Brian Norris
2019-04-04 10:21 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox