]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: fix dhcp6_prefixes_compare_func()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 6 Feb 2018 08:05:58 +0000 (17:05 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 6 Feb 2018 08:06:01 +0000 (17:06 +0900)
Found by the following warning by gcc.
```
../src/network/networkd-manager.c: In function 'dhcp6_prefixes_compare_func':
../src/network/networkd-manager.c:1383:16: warning: 'memcmp' reading 16 bytes from a region of size 8 [-Wstringop-overflow=]
         return memcmp(&a, &b, sizeof(*a));
                ^
```

src/network/networkd-manager.c

index 749b87f336dd70cb1fad396685f29d925adb6cb1..4f55c0172f7f0dfafb0cff7789fd85cbdb67b4e3 100644 (file)
@@ -1380,7 +1380,7 @@ static void dhcp6_prefixes_hash_func(const void *p, struct siphash *state) {
 static int dhcp6_prefixes_compare_func(const void *_a, const void *_b) {
         const struct in6_addr *a = _a, *b = _b;
 
-        return memcmp(&a, &b, sizeof(*a));
+        return memcmp(a, b, sizeof(*a));
 }
 
 static const struct hash_ops dhcp6_prefixes_hash_ops = {