mirror of
https://github.com/torvalds/linux.git
synced 2026-05-23 06:31:58 +02:00
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>
This commit is contained in:
parent
8f4e3d48bb
commit
e3e2207671
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user