2021-08-21 16:20:26

by Aakash Hemadri

[permalink] [raw]
Subject: [PATCH v3 1/5] staging: r8188eu: restricted __be16 degrades to int

Fix sparse warning:
> rtw_br_ext.c:73:23: warning: restricted __be16 degrades to integer

Here tag->tag_len is be16, use be16_to_cpu()

Signed-off-by: Aakash Hemadri <[email protected]>
---
drivers/staging/r8188eu/core/rtw_br_ext.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/r8188eu/core/rtw_br_ext.c b/drivers/staging/r8188eu/core/rtw_br_ext.c
index ee52f28a1e56..f6d1f6029ec3 100644
--- a/drivers/staging/r8188eu/core/rtw_br_ext.c
+++ b/drivers/staging/r8188eu/core/rtw_br_ext.c
@@ -70,7 +70,7 @@ static int __nat25_add_pppoe_tag(struct sk_buff *skb, struct pppoe_tag *tag)
struct pppoe_hdr *ph = (struct pppoe_hdr *)(skb->data + ETH_HLEN);
int data_len;

- data_len = tag->tag_len + TAG_HDR_LEN;
+ data_len = be16_to_cpu(tag->tag_len) + TAG_HDR_LEN;
if (skb_tailroom(skb) < data_len) {
_DEBUG_ERR("skb_tailroom() failed in add SID tag!\n");
return -1;
--
2.32.0


2021-08-21 17:27:07

by Phillip Potter

[permalink] [raw]
Subject: Re: [PATCH v3 1/5] staging: r8188eu: restricted __be16 degrades to int

On Sat, 21 Aug 2021 at 17:18, Aakash Hemadri <[email protected]> wrote:
>
> Fix sparse warning:
> > rtw_br_ext.c:73:23: warning: restricted __be16 degrades to integer
>
> Here tag->tag_len is be16, use be16_to_cpu()
>
> Signed-off-by: Aakash Hemadri <[email protected]>
> ---
> drivers/staging/r8188eu/core/rtw_br_ext.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/r8188eu/core/rtw_br_ext.c b/drivers/staging/r8188eu/core/rtw_br_ext.c
> index ee52f28a1e56..f6d1f6029ec3 100644
> --- a/drivers/staging/r8188eu/core/rtw_br_ext.c
> +++ b/drivers/staging/r8188eu/core/rtw_br_ext.c
> @@ -70,7 +70,7 @@ static int __nat25_add_pppoe_tag(struct sk_buff *skb, struct pppoe_tag *tag)
> struct pppoe_hdr *ph = (struct pppoe_hdr *)(skb->data + ETH_HLEN);
> int data_len;
>
> - data_len = tag->tag_len + TAG_HDR_LEN;
> + data_len = be16_to_cpu(tag->tag_len) + TAG_HDR_LEN;
> if (skb_tailroom(skb) < data_len) {
> _DEBUG_ERR("skb_tailroom() failed in add SID tag!\n");
> return -1;
> --
> 2.32.0
>

Thanks for this - looks good from what I can see.

Acked-by: Phillip Potter <[email protected]>

Regards,
Phil