* [PATCH] staging: rtl8723au: fix incorrect type in assignment warning
@ 2015-07-22 17:50 Steve Pennington
2015-07-22 17:56 ` Jes Sorensen
0 siblings, 1 reply; 4+ messages in thread
From: Steve Pennington @ 2015-07-22 17:50 UTC (permalink / raw)
To: Larry Finger, Jes Sorensen, Greg Kroah-Hartman, Greg Donald,
Joe Perches, Roberta Dobrescu, Masanari Iida, linux-wireless,
devel, linux-kernel
Cc: Steve Pennington
Repaced calls to htons and memcpy with a single call to put_unaligned_be16
to fix the following sparse warning:
drivers/staging/rtl8723au/core/rtw_recv.c:1557:21: warning: incorrect type in assignment (different base types)
drivers/staging/rtl8723au/core/rtw_recv.c:1557:21: expected unsigned short [unsigned] [assigned] [usertype] len
drivers/staging/rtl8723au/core/rtw_recv.c:1557:21: got restricted __be16 [usertype] <noident>
Signed-off-by: Steve Pennington <sgpenn@gmail.com>
---
drivers/staging/rtl8723au/core/rtw_recv.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c
index 274a4b6..ad0549c 100644
--- a/drivers/staging/rtl8723au/core/rtw_recv.c
+++ b/drivers/staging/rtl8723au/core/rtw_recv.c
@@ -1554,8 +1554,7 @@ static int wlanhdr_to_ethhdr (struct recv_frame *precvframe)
ether_addr_copy(ptr + ETH_ALEN, pattrib->src);
if (!bsnaphdr) {
- len = htons(len);
- memcpy(ptr + 12, &len, 2);
+ put_unaligned_be16(len, ptr + 12);
}
--
2.4.6
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] staging: rtl8723au: fix incorrect type in assignment warning
2015-07-22 17:50 [PATCH] staging: rtl8723au: fix incorrect type in assignment warning Steve Pennington
@ 2015-07-22 17:56 ` Jes Sorensen
0 siblings, 0 replies; 4+ messages in thread
From: Jes Sorensen @ 2015-07-22 17:56 UTC (permalink / raw)
To: Steve Pennington
Cc: Larry Finger, Greg Kroah-Hartman, Greg Donald, Joe Perches,
Roberta Dobrescu, Masanari Iida, linux-wireless, devel,
linux-kernel
Steve Pennington <sgpenn@gmail.com> writes:
> Repaced calls to htons and memcpy with a single call to put_unaligned_be16
You may want an 'l' in replaced, but not a biggie to me.
> to fix the following sparse warning:
> drivers/staging/rtl8723au/core/rtw_recv.c:1557:21: warning: incorrect type in assignment (different base types)
> drivers/staging/rtl8723au/core/rtw_recv.c:1557:21: expected unsigned short [unsigned] [assigned] [usertype] len
> drivers/staging/rtl8723au/core/rtw_recv.c:1557:21: got restricted __be16 [usertype] <noident>
>
> Signed-off-by: Steve Pennington <sgpenn@gmail.com>
> ---
> drivers/staging/rtl8723au/core/rtw_recv.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c
> index 274a4b6..ad0549c 100644
> --- a/drivers/staging/rtl8723au/core/rtw_recv.c
> +++ b/drivers/staging/rtl8723au/core/rtw_recv.c
> @@ -1554,8 +1554,7 @@ static int wlanhdr_to_ethhdr (struct recv_frame *precvframe)
> ether_addr_copy(ptr + ETH_ALEN, pattrib->src);
>
> if (!bsnaphdr) {
> - len = htons(len);
> - memcpy(ptr + 12, &len, 2);
> + put_unaligned_be16(len, ptr + 12);
> }
This one looks good to me.
Jes
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] staging: rtl8723au: fix incorrect type in assignment warning
@ 2015-07-21 17:31 Steve Pennington
2015-07-21 17:47 ` Jes Sorensen
0 siblings, 1 reply; 4+ messages in thread
From: Steve Pennington @ 2015-07-21 17:31 UTC (permalink / raw)
To: Larry Finger, Jes Sorensen, Greg Kroah-Hartman, Greg Donald,
Joe Perches, Roberta Dobrescu, Masanari Iida, linux-wireless,
devel, linux-kernel
Cc: Steve Pennington
Repaced call to htons with call to cpu_to_be16s to fix the
following sparse warning:
drivers/staging/rtl8723au/core/rtw_recv.c:1557:21: warning: incorrect type in assignment (different base types)
drivers/staging/rtl8723au/core/rtw_recv.c:1557:21: expected unsigned short [unsigned] [assigned] [usertype] len
drivers/staging/rtl8723au/core/rtw_recv.c:1557:21: got restricted __be16 [usertype] <noident>
Signed-off-by: Steve Pennington <sgpenn@gmail.com>
---
drivers/staging/rtl8723au/core/rtw_recv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c
index 274a4b6..39318ae 100644
--- a/drivers/staging/rtl8723au/core/rtw_recv.c
+++ b/drivers/staging/rtl8723au/core/rtw_recv.c
@@ -1554,7 +1554,7 @@ static int wlanhdr_to_ethhdr (struct recv_frame *precvframe)
ether_addr_copy(ptr + ETH_ALEN, pattrib->src);
if (!bsnaphdr) {
- len = htons(len);
+ cpu_to_be16s(&len);
memcpy(ptr + 12, &len, 2);
}
--
2.4.6
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] staging: rtl8723au: fix incorrect type in assignment warning
2015-07-21 17:31 Steve Pennington
@ 2015-07-21 17:47 ` Jes Sorensen
0 siblings, 0 replies; 4+ messages in thread
From: Jes Sorensen @ 2015-07-21 17:47 UTC (permalink / raw)
To: Steve Pennington
Cc: Larry Finger, Greg Kroah-Hartman, Greg Donald, Joe Perches,
Roberta Dobrescu, Masanari Iida, linux-wireless, devel,
linux-kernel
Steve Pennington <sgpenn@gmail.com> writes:
> Repaced call to htons with call to cpu_to_be16s to fix the
> following sparse warning:
> drivers/staging/rtl8723au/core/rtw_recv.c:1557:21: warning: incorrect type in assignment (different base types)
> drivers/staging/rtl8723au/core/rtw_recv.c:1557:21: expected unsigned short [unsigned] [assigned] [usertype] len
> drivers/staging/rtl8723au/core/rtw_recv.c:1557:21: got restricted __be16 [usertype] <noident>
>
> Signed-off-by: Steve Pennington <sgpenn@gmail.com>
> ---
> drivers/staging/rtl8723au/core/rtw_recv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c
> index 274a4b6..39318ae 100644
> --- a/drivers/staging/rtl8723au/core/rtw_recv.c
> +++ b/drivers/staging/rtl8723au/core/rtw_recv.c
> @@ -1554,7 +1554,7 @@ static int wlanhdr_to_ethhdr (struct recv_frame *precvframe)
> ether_addr_copy(ptr + ETH_ALEN, pattrib->src);
>
> if (!bsnaphdr) {
> - len = htons(len);
> + cpu_to_be16s(&len);
> memcpy(ptr + 12, &len, 2);
> }
Thats an awful fix - use put_unaligned_le16() instead.
Jes
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-07-22 17:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-22 17:50 [PATCH] staging: rtl8723au: fix incorrect type in assignment warning Steve Pennington
2015-07-22 17:56 ` Jes Sorensen
-- strict thread matches above, loose matches on Subject: below --
2015-07-21 17:31 Steve Pennington
2015-07-21 17:47 ` Jes Sorensen
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).