diff options
author | Thomas Haller <thaller@redhat.com> | 2023-03-03 19:15:06 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2023-03-03 19:31:18 +0100 |
commit | 40dd8bf93a2757c4ccc2d3c354cfc1fefb05839a (patch) | |
tree | a19f54c354fd29be473fcce8d99a48f0e46fbc09 | |
parent | d0732962d2f3d5637f5013f2a1ca8b63ccc0a8f5 (diff) |
platform/tests: avoid accessing in_addr_t via NMIPAddr union
The compiler may dislike this:
CC src/core/platform/tests/libNetworkManagerTest_la-test-common.lo
In function '_ip_address_add',
inlined from 'nmtstp_ip4_address_add' at ../src/core/platform/tests/test-common.c:1892:5:
../src/core/platform/tests/test-common.c:1807:63: error: array subscript 'NMIPAddr {aka const struct _NMIPAddr}[0]' is partly outside array bounds of 'in_addr_t[1]' {aka 'unsigned int[1]'} [-Werror=array-bounds]
1807 | peer_address->addr4,
| ~~~~~~~~~~~~^~~~~~~
../src/core/platform/tests/test-common.c: In function 'nmtstp_ip4_address_add':
../src/core/platform/tests/test-common.c:1886:36: note: object 'peer_address' of size 4
1886 | in_addr_t peer_address,
| ~~~~~~~~~~~~^~~~~~~~~~~~
...
Fixes: 06aafabf14e6 ('platform/test: add test adding IPv4 addresses that only differ by their peer-address')
-rw-r--r-- | src/core/platform/tests/test-common.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core/platform/tests/test-common.c b/src/core/platform/tests/test-common.c index 5a39d3aaf7..161c989df4 100644 --- a/src/core/platform/tests/test-common.c +++ b/src/core/platform/tests/test-common.c @@ -1893,9 +1893,13 @@ nmtstp_ip4_address_add(NMPlatform *platform, external_command, TRUE, ifindex, - (NMIPAddr *) &address, + &((NMIPAddr){ + .addr4 = address, + }), plen, - (NMIPAddr *) &peer_address, + &((NMIPAddr){ + .addr4 = peer_address, + }), lifetime, preferred, flags, |