From 292c1855531df7baab095ef608cda7240984340b Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Sun, 30 Jan 2022 02:59:12 +0100 Subject: passt: Address new clang-tidy warnings from LLVM 13.0.1 clang-tidy from LLVM 13.0.1 reports some new warnings from these checkers: - altera-unroll-loops, altera-id-dependent-backward-branch: ignore for the moment being, add a TODO item - bugprone-easily-swappable-parameters: ignore, nothing to do about those - readability-function-cognitive-complexity: ignore for the moment being, add a TODO item - altera-struct-pack-align: ignore, alignment is forced in protocol headers - concurrency-mt-unsafe: ignore for the moment being, add a TODO item Fix bugprone-implicit-widening-of-multiplication-result warnings, though, that's doable and they seem to make sense. Signed-off-by: Stefano Brivio --- util.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'util.c') diff --git a/util.c b/util.c index 46a539b..57b987a 100644 --- a/util.c +++ b/util.c @@ -51,7 +51,7 @@ void name(const char *format, ...) { \ clock_gettime(CLOCK_REALTIME, &tp); \ fprintf(stderr, "%li.%04li: ", \ tp.tv_sec - log_debug_start, \ - tp.tv_nsec / (100 * 1000)); \ + tp.tv_nsec / (100L * 1000)); \ } else { \ va_start(args, format); \ passt_vsyslog(level, format, args); \ @@ -305,12 +305,14 @@ void sock_probe_mem(struct ctx *c) sl = sizeof(v); if (setsockopt(s, SOL_SOCKET, SO_SNDBUF, &v, sizeof(v)) || - getsockopt(s, SOL_SOCKET, SO_SNDBUF, &v, &sl) || v < SNDBUF_BIG) + getsockopt(s, SOL_SOCKET, SO_SNDBUF, &v, &sl) || + (size_t)v < SNDBUF_BIG) c->low_wmem = 1; v = INT_MAX / 2; if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, &v, sizeof(v)) || - getsockopt(s, SOL_SOCKET, SO_RCVBUF, &v, &sl) || v < RCVBUF_BIG) + getsockopt(s, SOL_SOCKET, SO_RCVBUF, &v, &sl) || + (size_t)v < RCVBUF_BIG) c->low_rmem = 1; close(s); -- cgit v1.2.3