* [PATCH] staging: r8188eu: Fix sparse endianness warnings.
@ 2022-03-30 3:14 Charlie Sands
2022-03-30 7:11 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: Charlie Sands @ 2022-03-30 3:14 UTC (permalink / raw)
To: gregkh; +Cc: Larry.Finger, phil, linux-staging, linux-kernel
This patch fixes sparse warnings about the endianness of different
integers in the driver.
Signed-off-by: Charlie Sands <sandsch@northvilleschools.net>
---
drivers/staging/r8188eu/core/rtw_br_ext.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/r8188eu/core/rtw_br_ext.c b/drivers/staging/r8188eu/core/rtw_br_ext.c
index d68611ef22f8..ed41c4e30262 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)
return -1;
@@ -432,7 +432,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:
@@ -471,7 +471,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);
@@ -557,9 +557,11 @@ 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.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] staging: r8188eu: Fix sparse endianness warnings.
2022-03-30 3:14 [PATCH] staging: r8188eu: Fix sparse endianness warnings Charlie Sands
@ 2022-03-30 7:11 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2022-03-30 7:11 UTC (permalink / raw)
To: Charlie Sands; +Cc: gregkh, Larry.Finger, phil, linux-staging, linux-kernel
On Tue, Mar 29, 2022 at 11:14:05PM -0400, Charlie Sands wrote:
> This patch fixes sparse warnings about the endianness of different
> integers in the driver.
>
> Signed-off-by: Charlie Sands <sandsch@northvilleschools.net>
Thanks! This is a bugfix though so it needs a fixes tag.
Fixes: 15865124feed ("staging: r8188eu: introduce new core dir for RTL8188eu driver")
Otherwise:
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
It's surprising that this code works at all. I maybe have said before
that I suspect the pppoe stuff has not been well tested.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-30 7:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-30 3:14 [PATCH] staging: r8188eu: Fix sparse endianness warnings Charlie Sands
2022-03-30 7:11 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).