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=202602 header.b=Y5fXaGz2; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 08BD85A026E for ; Mon, 11 May 2026 12:03:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202602; t=1778493804; bh=G/jGN6fdFW1sFpQZIGpD2PI2Vcyh1IeMT5PX54UzpBA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y5fXaGz2NEeM7F4xfBQTz7vF6TvYdrv35zxjh+WNiZYfMWVh0/G10VAwvuVr2BpLq +sVEhbpjx7cJeoYj9y3qeadBRzLVT1vuDC0hyqTlXKFEHLiCIPB0U78Rg6RNnM2bj5 8KhisuzHdocTk3NCN2OMZcKu8TGZJlytHjsJ3cow8zDsj5382VLs7Mn8pOT8R8X18N pR3hAFWyiHRPWkisWVoIbD7ksBiYeuTdo8NQTeXLXRf4qxB2PBn0VZ7yUnSestYwcc LfVWLFIMy4EWVgX0m8s2K8lc7+CAh/jSLXuNmwIRGUQ3le1TwEnaxyFdqahLMa5NAc tAGc6DenAABPg== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4gDZzw0x79z4wJc; Mon, 11 May 2026 20:03:24 +1000 (AEST) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH 1/8] netlink: erromsg should be const in nl_status() Date: Mon, 11 May 2026 20:03:15 +1000 Message-ID: <20260511100322.1016757-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260511100322.1016757-1-david@gibson.dropbear.id.au> References: <20260511100322.1016757-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: XPXZPF2E3JC7XUZUWGBVN3UJUCZKWF3T X-Message-ID-Hash: XPXZPF2E3JC7XUZUWGBVN3UJUCZKWF3T 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: This pointer aliases part of the const nlmsghdr we're passed, so it should be const. While we're there, remove an unnecessary explicit cast (NLMSG_DATA() returns a void *, which implicitly casts to anything). This also removes a warning on cppcheck 2.20.0 and probably many other versions. Signed-off-by: David Gibson --- netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netlink.c b/netlink.c index 6b74e882..9076462b 100644 --- a/netlink.c +++ b/netlink.c @@ -170,7 +170,7 @@ static int nl_status(const struct nlmsghdr *nh, ssize_t n, uint32_t seq) return 0; } if (nh->nlmsg_type == NLMSG_ERROR) { - struct nlmsgerr *errmsg = (struct nlmsgerr *)NLMSG_DATA(nh); + const struct nlmsgerr *errmsg = NLMSG_DATA(nh); return errmsg->error; } -- 2.54.0