2023-05-08 09:02:23

by Ping-Ke Shih

[permalink] [raw]
Subject: [PATCH] wifi: rtw88: correct qsel_to_ep[] type as int

qsel_to_ep[] can be assigned negative value, so change type from 'u8' to
'int'. Otherwise, Smatch static checker warns:
drivers/net/wireless/realtek/rtw88/usb.c:219 rtw_usb_parse() warn:
assigning (-22) to unsigned variable 'rtwusb->qsel_to_ep[8]'

Cc: [email protected]
Fixes: a6f187f92bcc ("wifi: rtw88: usb: fix priority queue to endpoint mapping")
Reported-by: Dan Carpenter <[email protected]>
Link: https://lore.kernel.org/linux-wireless/[email protected]/
Cc: Sascha Hauer <[email protected]>
Signed-off-by: Ping-Ke Shih <[email protected]>
---
drivers/net/wireless/realtek/rtw88/usb.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtw88/usb.h b/drivers/net/wireless/realtek/rtw88/usb.h
index 30647f0dd61c6..ad1d7955c6a51 100644
--- a/drivers/net/wireless/realtek/rtw88/usb.h
+++ b/drivers/net/wireless/realtek/rtw88/usb.h
@@ -78,7 +78,7 @@ struct rtw_usb {
u8 pipe_interrupt;
u8 pipe_in;
u8 out_ep[RTW_USB_EP_MAX];
- u8 qsel_to_ep[TX_DESC_QSEL_MAX];
+ int qsel_to_ep[TX_DESC_QSEL_MAX];
u8 usb_txagg_num;

struct workqueue_struct *txwq, *rxwq;
--
2.25.1


2023-05-08 09:36:09

by David Laight

[permalink] [raw]
Subject: RE: [PATCH] wifi: rtw88: correct qsel_to_ep[] type as int

From: Ping-Ke Shih
> Sent: 08 May 2023 09:56
>
> qsel_to_ep[] can be assigned negative value, so change type from 'u8' to
> 'int'. Otherwise, Smatch static checker warns:
> drivers/net/wireless/realtek/rtw88/usb.c:219 rtw_usb_parse() warn:
> assigning (-22) to unsigned variable 'rtwusb->qsel_to_ep[8]'

I think s8 would do.
Either that or an alternative error value.

David

>
> Cc: [email protected]
> Fixes: a6f187f92bcc ("wifi: rtw88: usb: fix priority queue to endpoint mapping")
> Reported-by: Dan Carpenter <[email protected]>
> Link: https://lore.kernel.org/linux-wireless/[email protected]/
> Cc: Sascha Hauer <[email protected]>
> Signed-off-by: Ping-Ke Shih <[email protected]>
> ---
> drivers/net/wireless/realtek/rtw88/usb.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/realtek/rtw88/usb.h b/drivers/net/wireless/realtek/rtw88/usb.h
> index 30647f0dd61c6..ad1d7955c6a51 100644
> --- a/drivers/net/wireless/realtek/rtw88/usb.h
> +++ b/drivers/net/wireless/realtek/rtw88/usb.h
> @@ -78,7 +78,7 @@ struct rtw_usb {
> u8 pipe_interrupt;
> u8 pipe_in;
> u8 out_ep[RTW_USB_EP_MAX];
> - u8 qsel_to_ep[TX_DESC_QSEL_MAX];
> + int qsel_to_ep[TX_DESC_QSEL_MAX];
> u8 usb_txagg_num;
>
> struct workqueue_struct *txwq, *rxwq;
> --
> 2.25.1

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

2023-05-08 19:02:49

by Larry Finger

[permalink] [raw]
Subject: Re: [PATCH] wifi: rtw88: correct qsel_to_ep[] type as int

On 5/8/23 03:55, Ping-Ke Shih wrote:
> qsel_to_ep[] can be assigned negative value, so change type from 'u8' to
> 'int'. Otherwise, Smatch static checker warns:
> drivers/net/wireless/realtek/rtw88/usb.c:219 rtw_usb_parse() warn:
> assigning (-22) to unsigned variable 'rtwusb->qsel_to_ep[8]'
>
> Cc: [email protected]
> Fixes: a6f187f92bcc ("wifi: rtw88: usb: fix priority queue to endpoint mapping")
> Reported-by: Dan Carpenter <[email protected]>
> Link: https://lore.kernel.org/linux-wireless/[email protected]/
> Cc: Sascha Hauer <[email protected]>
> Signed-off-by: Ping-Ke Shih <[email protected]>
> ---

Tested-by: Larry Finger <[email protected]>

Larry

2023-05-15 18:21:12

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH] wifi: rtw88: correct qsel_to_ep[] type as int

Ping-Ke Shih <[email protected]> wrote:

> qsel_to_ep[] can be assigned negative value, so change type from 'u8' to
> 'int'. Otherwise, Smatch static checker warns:
> drivers/net/wireless/realtek/rtw88/usb.c:219 rtw_usb_parse() warn:
> assigning (-22) to unsigned variable 'rtwusb->qsel_to_ep[8]'
>
> Cc: [email protected]
> Fixes: a6f187f92bcc ("wifi: rtw88: usb: fix priority queue to endpoint mapping")
> Reported-by: Dan Carpenter <[email protected]>
> Link: https://lore.kernel.org/linux-wireless/[email protected]/
> Cc: Sascha Hauer <[email protected]>
> Signed-off-by: Ping-Ke Shih <[email protected]>
> Acked-by: Sascha Hauer <[email protected]>
> Tested-by: Larry Finger <[email protected]>

Patch applied to wireless.git, thanks.

8e4942db5f5e wifi: rtw88: correct qsel_to_ep[] type as int

--
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches