From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=fail (p=quarantine dis=none) header.from=redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id 66F465A026E for ; Thu, 15 Oct 2026 12:07:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1792058874; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zBtxeB/DVkY4Zq0Tk/DZkT2KqHARL9s8GBFC1Rl0z/Y=; b=OP9+c98U8rvWb+SG5eqaHxbr7/VyWAQVbJe5j2/8GwNgDQGCOc/6wHgLx/1KlK2OlzPxCl uCJULLb66raE99k8LOqiMlXhADvUlUlPeo5bYdSAFhuib3vJclVQ8UkASiE1fgmg5p3XoT 4LNeFSqAG/L1Eg1ykQzZEBmBzRoQazQ= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-371-W3g1bgavOViE-aEN0_LNaw-1; Thu, 15 Oct 2026 10:07:47 +0000 X-MC-Unique: W3g1bgavOViE-aEN0_LNaw-1 X-Mimecast-MFC-AGG-ID: W3g1bgavOViE-aEN0_LNaw_1792058866 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2ADBA180066C for ; Thu, 15 Oct 2026 10:07:46 +0000 (UTC) Received: from lenovo-t14s.redhat.corp (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 52C281955F10; Thu, 15 Oct 2026 10:07:45 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH 2/2] passt-repair: Suppress false positive cppcheck negativeIndex warning Date: Thu, 15 Oct 2026 12:07:41 +0200 Message-ID: <20261015100741.1583455-3-lvivier@redhat.com> In-Reply-To: <20261015100741.1583455-1-lvivier@redhat.com> References: <20261015100741.1583455-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: izrQ1unfSuV1-f35gAIJUMutkaZ5UHfq7KbGHVtrEP8_1792058866 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: 7ZGVXDDOTKUXRBMOSDBSLJZUUR6Q3UOL X-Message-ID-Hash: 7ZGVXDDOTKUXRBMOSDBSLJZUUR6Q3UOL X-MailFrom: lvivier@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Laurent Vivier X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- passt-repair.c | 1 + 1 file changed, 1 insertion(+) diff --git a/passt-repair.c b/passt-repair.c index 80a39086e568..bd9db4d32086 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 */ buf[n - 1] = '\0'; for (p = buf; p < buf + n; p += sizeof(*ev) + ev->len) { ev = (const struct inotify_event *)p; -- 2.56.0