diff options
author | Arnd Bergmann <arnd@arndb.de> | 2021-05-08 00:07:56 +0200 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2021-05-17 13:30:29 +0200 |
commit | e3e22076710632250cfaee853499f3de6e9be35d (patch) | |
tree | b94e7a4e2c077a2928d2b8fa2bddadb2c434f93e /net | |
parent | mwifiex: re-fix for unaligned accesses (diff) | |
download | linux-e3e22076710632250cfaee853499f3de6e9be35d.tar.xz linux-e3e22076710632250cfaee853499f3de6e9be35d.zip |
netpoll: avoid put_unaligned() on single character
With a planned cleanup, using put_unaligned() on a single character
results in a harmless warning:
In file included from ./arch/x86/include/generated/asm/unaligned.h:1,
from include/linux/etherdevice.h:24,
from net/core/netpoll.c:18:
net/core/netpoll.c: In function 'netpoll_send_udp':
include/asm-generic/unaligned.h:23:9: error: 'packed' attribute ignored for field of type 'unsigned char' [-Werror=attributes]
net/core/netpoll.c:431:3: note: in expansion of macro 'put_unaligned'
431 | put_unaligned(0x60, (unsigned char *)ip6h);
| ^~~~~~~~~~~~~
include/asm-generic/unaligned.h:23:9: error: 'packed' attribute ignored for field of type 'unsigned char' [-Werror=attributes]
net/core/netpoll.c:459:3: note: in expansion of macro 'put_unaligned'
459 | put_unaligned(0x45, (unsigned char *)iph);
| ^~~~~~~~~~~~~
Replace this with an open-coded pointer dereference.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/netpoll.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index c310c7c1cef7..9c49a38fa315 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -428,7 +428,7 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len) ip6h = ipv6_hdr(skb); /* ip6h->version = 6; ip6h->priority = 0; */ - put_unaligned(0x60, (unsigned char *)ip6h); + *(unsigned char *)ip6h = 0x60; ip6h->flow_lbl[0] = 0; ip6h->flow_lbl[1] = 0; ip6h->flow_lbl[2] = 0; @@ -456,7 +456,7 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len) iph = ip_hdr(skb); /* iph->version = 4; iph->ihl = 5; */ - put_unaligned(0x45, (unsigned char *)iph); + *(unsigned char *)iph = 0x45; iph->tos = 0; put_unaligned(htons(ip_len), &(iph->tot_len)); iph->id = htons(atomic_inc_return(&ip_ident)); |