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=202512 header.b=OyBSN4lG; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id D7B145A0271 for ; Tue, 13 Jan 2026 04:54:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202512; t=1768276457; bh=A1e8Vd6FrOu74WIAnoU4ElLQucJaXcoq3XnSNi49b3g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OyBSN4lGpVgIfwUfm9OjxOlOi55foSn+jeVYwUZgci0UM+ziklxsDyv1/Kul9y+Sa fPSebWaValoaKbHswJt/PlcEaMjoXf8F9wqIzfyPQvIxQozeAAJ+dEhI8TzcdH2dmc wPQYxpEThfHwnMi32NzBkKZzkwnp5GpKwcd2J5mH/NqPNsqK3pNu2Pq3vlOijqfTtm E7Hyi0/sslTMwbImkqwVpBl+n7SoKjs20afwJSheLETj3PI3gmQYIyTG+fA1jluWy+ kdl0jm/r8yzSk+0t87IeNqka52LZ6ZCgfnVjtaCxFXH6ATvjba7qqa/xnYQy1EAF1Q z+F0UMdn6F4Nw== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4dqwNT6QQ4z4wR9; Tue, 13 Jan 2026 14:54:17 +1100 (AEDT) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH 1/3] treewide: Fix more pointers which can be const Date: Tue, 13 Jan 2026 14:54:13 +1100 Message-ID: <20260113035415.685242-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260113035415.685242-1-david@gibson.dropbear.id.au> References: <20260113035415.685242-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: M45M2HGUZDMG45ZAHF2ERJRSTHVT2VEH X-Message-ID-Hash: M45M2HGUZDMG45ZAHF2ERJRSTHVT2VEH 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: Here are some more pointers which can be const, as reported by cppcheck 2.19.1. Signed-off-by: David Gibson --- conf.c | 2 +- dhcpv6.c | 3 ++- vhost_user.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/conf.c b/conf.c index b1fc4b9f..a242fda1 100644 --- a/conf.c +++ b/conf.c @@ -1224,7 +1224,7 @@ dns6: * * Return: 0 on success, negative error code on failure */ -static int conf_runas(char *opt, unsigned int *uid, unsigned int *gid) +static int conf_runas(const char *opt, unsigned int *uid, unsigned int *gid) { const char *uopt, *gopt = NULL; char *sep = strchr(opt, ':'); diff --git a/dhcpv6.c b/dhcpv6.c index d94be23a..97c04e2c 100644 --- a/dhcpv6.c +++ b/dhcpv6.c @@ -320,7 +320,7 @@ static bool dhcpv6_opt(struct iov_tail *data, uint16_t type) static bool dhcpv6_ia_notonlink(struct iov_tail *data, struct in6_addr *la) { - int ia_types[2] = { OPT_IA_NA, OPT_IA_TA }, *ia_type; + int ia_types[2] = { OPT_IA_NA, OPT_IA_TA }; struct opt_ia_addr opt_addr_storage; const struct opt_ia_addr *opt_addr; struct iov_tail current, ia_base; @@ -330,6 +330,7 @@ static bool dhcpv6_ia_notonlink(struct iov_tail *data, struct in6_addr req_addr; struct opt_hdr h_storage; const struct opt_hdr *h; + const int *ia_type; foreach(ia_type, ia_types) { current = *data; diff --git a/vhost_user.c b/vhost_user.c index 1e320bff..9fe12411 100644 --- a/vhost_user.c +++ b/vhost_user.c @@ -442,7 +442,7 @@ static bool vu_set_mem_table_exec(struct vu_dev *vdev, for (i = 0; i < vdev->memory.nregions; i++) { struct vhost_user_memory_region *msg_region = &memory->regions[i]; struct vu_dev_region *dev_region = &vdev->memory.regions[i]; - void *mmap_addr; + const void *mmap_addr; debug("vhost-user region %d", i); debug(" guest_phys_addr: 0x%016"PRIx64, -- 2.52.0