From 6aa4f88bd9846411edff3ed70460475b538addca Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Thu, 15 Oct 2026 12:07:41 +0200 Subject: passt-repair: Suppress false positive cppcheck negativeIndex warning By the time we reach buf[n - 1] = '\0', n < 0 and n < sizeof(*ev) are already handled above, so the index is always positive. Add a cppcheck-suppress annotation to silence the false positive. Signed-off-by: Laurent Vivier [sbrivio: Add unmatchedSuppression for compatibility] Signed-off-by: Stefano Brivio --- passt-repair.c | 1 + 1 file changed, 1 insertion(+) diff --git a/passt-repair.c b/passt-repair.c index 80a3908..3958c3a 100644 --- a/passt-repair.c +++ b/passt-repair.c @@ -95,6 +95,7 @@ static int wait_for_socket(struct sockaddr_un *a, const char *dir, continue; } + /* cppcheck-suppress [negativeIndex, unmatchedSuppression] */ buf[n - 1] = '\0'; for (p = buf; p < buf + n; p += sizeof(*ev) + ev->len) { ev = (const struct inotify_event *)p; -- cgit v1.2.3