diff mbox series

wifi: rt2x00: simplify rt2x00crypto_rx_insert_iv()

Message ID 20231019070750.17911-1-dmantipov@yandex.ru
State New
Headers show
Series wifi: rt2x00: simplify rt2x00crypto_rx_insert_iv() | expand

Commit Message

Dmitry Antipov Oct. 19, 2023, 7:06 a.m. UTC
In 'rt2x00crypto_rx_insert_iv()', added alignment can't exceed 3
bytes and ICV size is either 4 or 8 bytes, so skb space adjustment
may be simplified. Compile tested only.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
 drivers/net/wireless/ralink/rt2x00/rt2x00crypto.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Kalle Valo Jan. 18, 2024, 1:07 p.m. UTC | #1
Dmitry Antipov <dmantipov@yandex.ru> wrote:

> In 'rt2x00crypto_rx_insert_iv()', added alignment can't exceed 3
> bytes and ICV size is either 4 or 8 bytes, so skb space adjustment
> may be simplified. Compile tested only.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>

Patch applied to wireless-next.git, thanks.

173b0fb47c3d wifi: rt2x00: simplify rt2x00crypto_rx_insert_iv()
diff mbox series

Patch

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00crypto.c b/drivers/net/wireless/ralink/rt2x00/rt2x00crypto.c
index ad95f9eba301..1000fbfb94b8 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00crypto.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00crypto.c
@@ -197,10 +197,7 @@  void rt2x00crypto_rx_insert_iv(struct sk_buff *skb,
 		transfer += header_length;
 	} else {
 		skb_push(skb, iv_len + align);
-		if (align < icv_len)
-			skb_put(skb, icv_len - align);
-		else if (align > icv_len)
-			skb_trim(skb, rxdesc->size + iv_len + icv_len);
+		skb_put(skb, icv_len - align);
 
 		/* Move ieee80211 header */
 		memmove(skb->data + transfer,