mirror of
https://github.com/systemd/systemd.git
synced 2025-03-22 06:50:18 +03:00
network: avoid warning about unaligned pointers
With gcc-9.0.1-0.10.fc30.x86_64: ../src/network/netdev/macsec.c: In function ‘config_parse_macsec_port’: ../src/network/netdev/macsec.c:584:24: warning: taking address of packed member of ‘struct <anonymous>’ may result in an unaligned pointer value [-Waddress-of-packed-member] 584 | dest = &c->sci.port; | ^~~~~~~~~~~~ ../src/network/netdev/macsec.c:592:24: warning: taking address of packed member of ‘struct <anonymous>’ may result in an unaligned pointer value [-Waddress-of-packed-member] 592 | dest = &b->sci.port; | ^~~~~~~~~~~~ (The alignment was probably OK, but it's nicer to avoid the warning anyway.)
This commit is contained in:
parent
cc83684947
commit
e61614099f
@ -563,7 +563,7 @@ int config_parse_macsec_port(
|
||||
_cleanup_(macsec_receive_channel_free_or_set_invalidp) ReceiveChannel *c = NULL;
|
||||
MACsec *s = userdata;
|
||||
uint16_t port;
|
||||
be16_t *dest;
|
||||
void *dest;
|
||||
int r;
|
||||
|
||||
assert(filename);
|
||||
@ -600,7 +600,7 @@ int config_parse_macsec_port(
|
||||
return 0;
|
||||
}
|
||||
|
||||
*dest = htobe16(port);
|
||||
unaligned_write_be16(dest, port);
|
||||
|
||||
TAKE_PTR(b);
|
||||
TAKE_PTR(c);
|
||||
|
Loading…
x
Reference in New Issue
Block a user