From 12cfa6444cd239dbc04391027ad3161f53b6901c Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Wed, 20 Oct 2021 00:05:11 +0200 Subject: passt: Add clang-tidy Makefile target and test, take care of warnings Most are just about style and form, but a few were actually serious mistakes (NDP-related). Signed-off-by: Stefano Brivio --- util.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'util.c') diff --git a/util.c b/util.c index 56b256d..4c2e9bb 100644 --- a/util.c +++ b/util.c @@ -143,7 +143,7 @@ void passt_vsyslog(int pri, const char *format, va_list ap) n += snprintf(buf + n, BUFSIZ - n, "\n"); if (log_opt | LOG_PERROR) - fprintf(stderr, buf + sizeof("<0>")); + fprintf(stderr, "%s", buf + sizeof("<0>")); send(log_sock, buf, n, 0); } @@ -362,7 +362,7 @@ void bitmap_clear(uint8_t *map, int bit) * * Return: non-zero if given bit is set, zero if it's not */ -int bitmap_isset(uint8_t *map, int bit) +int bitmap_isset(const uint8_t *map, int bit) { return map[bit / 8] & (1 << bit % 8); } @@ -437,6 +437,7 @@ void procfs_scan_listen(char *name, uint8_t *map, uint8_t *exclude) *line = 0; line_read(line, sizeof(line), fd); while (line_read(line, sizeof(line), fd)) { + /* NOLINTNEXTLINE(cert-err34-c): != 2 if conversion fails */ if (sscanf(line, "%*u: %*x:%lx %*x:%*x %x", &port, &state) != 2) continue; -- cgit v1.2.3