diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2021-10-21 09:41:13 +0200 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2021-10-21 09:41:13 +0200 |
commit | 627e18fa8ad000ed92405cff3a88c36fd5f3027e (patch) | |
tree | 5caf72002139dd6bc80cd424de1730f8602cbb9d /netlink.c | |
parent | c3f8e4d2cd55e57419478ff849265d1e342e7990 (diff) | |
download | passt-627e18fa8ad000ed92405cff3a88c36fd5f3027e.tar passt-627e18fa8ad000ed92405cff3a88c36fd5f3027e.tar.gz passt-627e18fa8ad000ed92405cff3a88c36fd5f3027e.tar.bz2 passt-627e18fa8ad000ed92405cff3a88c36fd5f3027e.tar.lz passt-627e18fa8ad000ed92405cff3a88c36fd5f3027e.tar.xz passt-627e18fa8ad000ed92405cff3a88c36fd5f3027e.tar.zst passt-627e18fa8ad000ed92405cff3a88c36fd5f3027e.zip |
passt: Add cppcheck target, test, and address resulting warnings
...mostly false positives, but a number of very relevant ones too,
in tcp_get_sndbuf(), tcp_conn_from_tap(), and siphash PREAMBLE().
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'netlink.c')
-rw-r--r-- | netlink.c | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -47,7 +47,6 @@ static int nl_seq; static int nl_sock_init_do(void *arg) { struct sockaddr_nl addr = { .nl_family = AF_NETLINK, }; - struct ctx *c = (struct ctx *)arg; int *s = &nl_sock, v = 1; ns: @@ -55,7 +54,7 @@ ns: bind(*s, (struct sockaddr *)&addr, sizeof(addr))) *s = -1; - if (*s == -1 || !c || s == &nl_sock_ns) + if (*s == -1 || !arg || s == &nl_sock_ns) return 0; setsockopt(*s, SOL_NETLINK, NETLINK_GET_STRICT_CHK, &v, sizeof(v)); @@ -206,11 +205,10 @@ v6: word = (long *)has_v4; for (i = 0; i < ARRAY_SIZE(has_v4) / sizeof(long); i++, word++) { - int ifi; - tmp = *word; while ((n = ffsl(tmp))) { - ifi = i * sizeof(long) * 8 + n - 1; + int ifi = i * sizeof(long) * 8 + n - 1; + if (!first_v4) first_v4 = ifi; |