From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202502 header.b=gbUmxmZx; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id ED1685A077E for ; Mon, 17 Mar 2025 11:02:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202502; t=1742205731; bh=Z7ydcyAwA2OOFcqDn8jh8H60dgW84JHTwBpnX2xLqic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gbUmxmZx4rqWD2LVTSXwdBgjhcFPxQpKJlA0ae+7Sqffo2GmRqvwCKoQsLpCEoijl YCMMWTV/9Dg35SNWLphQx0K9akCOImD+2qrGb5ODIukbFEDXbsVVMj2PtqOIkrsWTy 4A0RZLs/Q1/Cl8AWz+wEpyJ95UUrhhAcOr9gWP/+yNBWQUWrxqxnbugmcU3XWb8xto ZrarVUJGU5DNg0unWtMFaJlFd8tQebZ9Z073CW6F9XoLk91fRI5rDMG6YYoLuSzcb7 BpF7XnnD2humwOM7sLUK0n7RYvdHQ/AEfn39AeQHMEQNPvHaDnYS34qsjw2ntzYN7B ani1t93GxSiIw== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4ZGVrM6WVlz4xFb; Mon, 17 Mar 2025 21:02:11 +1100 (AEDT) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v2 11/11] packet: Upgrade severity of most packet errors Date: Mon, 17 Mar 2025 20:24:24 +1100 Message-ID: <20250317092424.1461719-12-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250317092424.1461719-1-david@gibson.dropbear.id.au> References: <20250317092424.1461719-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: H7TXFVRE7UFHT6ISGUQIUKNUQRKKAYNL X-Message-ID-Hash: H7TXFVRE7UFHT6ISGUQIUKNUQRKKAYNL X-MailFrom: dgibson@gandalf.ozlabs.org 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: David Gibson 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: All errors from packet_range_check(), packet_add() and packet_get() are trace level. However, these are for the most part actual error conditions. They're states that should not happen, in many cases indicating a bug in the caller or elswhere. We don't promote these to err() or ASSERT() level, for fear of a localised bug on very specific input crashing the entire program, or flooding the logs, but we can at least upgrade them to debug level. Signed-off-by: David Gibson --- packet.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packet.c b/packet.c index be28f279..72c61580 100644 --- a/packet.c +++ b/packet.c @@ -36,7 +36,7 @@ static int packet_check_range(const struct pool *p, const char *ptr, size_t len, const char *func, int line) { if (len > PACKET_MAX_LEN) { - trace("packet range length %zu (max %zu), %s:%i", + debug("packet range length %zu (max %zu), %s:%i", len, PACKET_MAX_LEN, func, line); return -1; } @@ -47,25 +47,25 @@ static int packet_check_range(const struct pool *p, const char *ptr, size_t len, ret = vu_packet_check_range((void *)p->buf, ptr, len); if (ret == -1) - trace("cannot find region, %s:%i", func, line); + debug("cannot find region, %s:%i", func, line); return ret; } if (ptr < p->buf) { - trace("packet range start %p before buffer start %p, %s:%i", + debug("packet range start %p before buffer start %p, %s:%i", (void *)ptr, (void *)p->buf, func, line); return -1; } if (len > p->buf_size) { - trace("packet range length %zu larger than buffer %zu, %s:%i", + debug("packet range length %zu larger than buffer %zu, %s:%i", len, p->buf_size, func, line); return -1; } if ((size_t)(ptr - p->buf) > p->buf_size - len) { - trace("packet range %p, len %zu after buffer end %p, %s:%i", + debug("packet range %p, len %zu after buffer end %p, %s:%i", (void *)ptr, len, (void *)(p->buf + p->buf_size), func, line); return -1; @@ -98,7 +98,7 @@ void packet_add_do(struct pool *p, size_t len, const char *start, size_t idx = p->count; if (pool_full(p)) { - trace("add packet index %zu to pool with size %zu, %s:%i", + debug("add packet index %zu to pool with size %zu, %s:%i", idx, p->size, func, line); return; } @@ -134,7 +134,7 @@ void *packet_get_try_do(const struct pool *p, size_t idx, size_t offset, p->count, p->size, func, line); if (idx >= p->count) { - trace("packet %zu from pool count: %zu, %s:%i", + debug("packet %zu from pool count: %zu, %s:%i", idx, p->count, func, line); return NULL; } -- 2.48.1