Hi,
This patch series fixes some sparse warnings in rtw_br_ext.c
Thanks,
Aakash Hemadri
Aakash Hemadri (5):
staging: r8188eu: restricted __be16 degrades to int
staging: r8188eu: cast to restricted __be32
staging: r8188eu: incorrect type in csum_ipv6_magic
staging: r8188eu: restricted __be16 degrades to int
staging: r8188eu: incorrect type in assignment
drivers/staging/r8188eu/core/rtw_br_ext.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
base-commit: 093991aaadf0fbb34184fa37a46e7a157da3f386
--
2.32.0
Fix sparse warning:
> rtw_br_ext.c:771:84: got restricted __be16 [usertype] payload_len
> rtw_br_ext.c:773:110: warning: incorrect type in argument 2
(different base types)
> rtw_br_ext.c:773:110: expected int len
> rtw_br_ext.c:773:110: got restricted __be16 [usertype] payload_len
csum_ipv6_magic and csum_partial expect int len not __be16, use
be16_to_cpu()
Signed-off-by: Aakash Hemadri <[email protected]>
---
drivers/staging/r8188eu/core/rtw_br_ext.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/r8188eu/core/rtw_br_ext.c b/drivers/staging/r8188eu/core/rtw_br_ext.c
index f65d94bfa286..26606093a3c3 100644
--- a/drivers/staging/r8188eu/core/rtw_br_ext.c
+++ b/drivers/staging/r8188eu/core/rtw_br_ext.c
@@ -615,9 +615,9 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
struct icmp6hdr *hdr = (struct icmp6hdr *)(skb->data + ETH_HLEN + sizeof(*iph));
hdr->icmp6_cksum = 0;
hdr->icmp6_cksum = csum_ipv6_magic(&iph->saddr, &iph->daddr,
- iph->payload_len,
+ be16_to_cpu(iph->payload_len),
IPPROTO_ICMPV6,
- csum_partial((__u8 *)hdr, iph->payload_len, 0));
+ csum_partial((__u8 *)hdr, be16_to_cpu(iph->payload_len), 0));
}
}
}
--
2.32.0
Fix sparse warning:
> rtw_br_ext.c:839:70: warning: restricted __be16 degrades to integer
> rtw_br_ext.c:845:70: warning: invalid assignment: |=
> rtw_br_ext.c:845:70: left side has type unsigned short
> rtw_br_ext.c:845:70: right side has type restricted __be16
dhcp->flags is be16, so change its type to that.
Change htons() to cpu_to_be16() for clarity.
Signed-off-by: Aakash Hemadri <[email protected]>
---
drivers/staging/r8188eu/core/rtw_br_ext.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/r8188eu/core/rtw_br_ext.c b/drivers/staging/r8188eu/core/rtw_br_ext.c
index 26606093a3c3..83a4594a4214 100644
--- a/drivers/staging/r8188eu/core/rtw_br_ext.c
+++ b/drivers/staging/r8188eu/core/rtw_br_ext.c
@@ -641,7 +641,7 @@ struct dhcpMessage {
u_int8_t hops;
u_int32_t xid;
u_int16_t secs;
- u_int16_t flags;
+ __be16 flags;
u_int32_t ciaddr;
u_int32_t yiaddr;
u_int32_t siaddr;
@@ -674,13 +674,13 @@ void dhcp_flag_bcast(struct adapter *priv, struct sk_buff *skb)
u32 cookie = be32_to_cpu(dhcph->cookie);
if (cookie == DHCP_MAGIC) { /* match magic word */
- if (!(dhcph->flags & htons(BROADCAST_FLAG))) {
+ if (!(dhcph->flags & cpu_to_be16(BROADCAST_FLAG))) {
/* if not broadcast */
register int sum = 0;
DEBUG_INFO("DHCP: change flag of DHCP request to broadcast.\n");
/* or BROADCAST flag */
- dhcph->flags |= htons(BROADCAST_FLAG);
+ dhcph->flags |= cpu_to_be16(BROADCAST_FLAG);
/* recalculate checksum */
sum = ~(udph->check) & 0xffff;
sum += be16_to_cpu(dhcph->flags);
--
2.32.0
Fix sparse warning:
> rtw_br_ext.c:516:57: warning: incorrect type in assignment
(different base types)
> rtw_br_ext.c:516:57: expected unsigned short
> rtw_br_ext.c:516:57: got restricted __be16 [usertype]
*pMagic holds __be16 change it's type to __be16
Signed-off-by: Aakash Hemadri <[email protected]>
---
drivers/staging/r8188eu/core/rtw_br_ext.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/r8188eu/core/rtw_br_ext.c b/drivers/staging/r8188eu/core/rtw_br_ext.c
index 83a4594a4214..14cf13516d34 100644
--- a/drivers/staging/r8188eu/core/rtw_br_ext.c
+++ b/drivers/staging/r8188eu/core/rtw_br_ext.c
@@ -474,7 +474,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
/* Handle PPPoE frame */
/*---------------------------------------------------*/
struct pppoe_hdr *ph = (struct pppoe_hdr *)(skb->data + ETH_HLEN);
- unsigned short *pMagic;
+ __be16 *pMagic;
switch (method) {
case NAT25_CHECK:
@@ -512,7 +512,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
tag->tag_len = htons(MAGIC_CODE_LEN+RTL_RELAY_TAG_LEN+old_tag_len);
/* insert the magic_code+client mac in relay tag */
- pMagic = (unsigned short *)tag->tag_data;
+ pMagic = (__be16 *)tag->tag_data;
*pMagic = htons(MAGIC_CODE);
memcpy(tag->tag_data+MAGIC_CODE_LEN, skb->data+ETH_ALEN, ETH_ALEN);
--
2.32.0
On Sat, Aug 21, 2021 at 09:48:27PM +0530, Aakash Hemadri wrote:
> Hi,
> This patch series fixes some sparse warnings in rtw_br_ext.c
>
> Thanks,
> Aakash Hemadri
>
> Aakash Hemadri (5):
> staging: r8188eu: restricted __be16 degrades to int
> staging: r8188eu: cast to restricted __be32
> staging: r8188eu: incorrect type in csum_ipv6_magic
> staging: r8188eu: restricted __be16 degrades to int
> staging: r8188eu: incorrect type in assignment
>
> drivers/staging/r8188eu/core/rtw_br_ext.c | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
>
> base-commit: 093991aaadf0fbb34184fa37a46e7a157da3f386
> --
> 2.32.0
>
>
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.
You are receiving this message because of the following common error(s)
as indicated below:
- This looks like a new version of a previously submitted patch, but you
did not list below the --- line any changes from the previous version.
Please read the section entitled "The canonical patch format" in the
kernel file, Documentation/SubmittingPatches for what needs to be done
here to properly describe this.
If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.
thanks,
greg k-h's patch email bot
On 8/21/21 11:18 AM, Aakash Hemadri wrote:
> Fix sparse warning:
>> rtw_br_ext.c:516:57: warning: incorrect type in assignment
> (different base types)
>> rtw_br_ext.c:516:57: expected unsigned short
>> rtw_br_ext.c:516:57: got restricted __be16 [usertype]
>
> *pMagic holds __be16 change it's type to __be16
>
> Signed-off-by: Aakash Hemadri <[email protected]>
> ---
> drivers/staging/r8188eu/core/rtw_br_ext.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/core/rtw_br_ext.c b/drivers/staging/r8188eu/core/rtw_br_ext.c
> index 83a4594a4214..14cf13516d34 100644
> --- a/drivers/staging/r8188eu/core/rtw_br_ext.c
> +++ b/drivers/staging/r8188eu/core/rtw_br_ext.c
> @@ -474,7 +474,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
> /* Handle PPPoE frame */
> /*---------------------------------------------------*/
> struct pppoe_hdr *ph = (struct pppoe_hdr *)(skb->data + ETH_HLEN);
> - unsigned short *pMagic;
> + __be16 *pMagic;
>
> switch (method) {
> case NAT25_CHECK:
> @@ -512,7 +512,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
> tag->tag_len = htons(MAGIC_CODE_LEN+RTL_RELAY_TAG_LEN+old_tag_len);
>
> /* insert the magic_code+client mac in relay tag */
> - pMagic = (unsigned short *)tag->tag_data;
> + pMagic = (__be16 *)tag->tag_data;
> *pMagic = htons(MAGIC_CODE);
> memcpy(tag->tag_data+MAGIC_CODE_LEN, skb->data+ETH_ALEN, ETH_ALEN);
>
>
For all 5 patches,
Ack by Larry Finger <Larry.finger#lwfinger.net>
Thanks,
Larry