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=202410 header.b=OWksMjYD; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 351105A0622 for ; Wed, 06 Nov 2024 00:27:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202410; t=1730849254; bh=+Yn1teWkDSYtd7XwfGMdfFfyy10E2QdRT/1gAzuh+nI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OWksMjYDLlXNOBn1WZdDLdcpyBtPAPqSjy4Cj/athwm1zHhI0ZA9p98uyJF9muHAe u+rk8aJ4WPJsru0TmFrvldHcWIb9ccLVReaZJS8XpjiOwd/NscE7QiYeErRlP4IhO4 TfCDBp/FMz86VhJShZ9GsBa8mPvYDJyUyCop1MQnids+UUs4NQi3nrIuCv9qkpkeUT WnedWuYh3W4B3ThxN63lCiHKN39IsPkZcXPGQsR2T2nEReRjSct+a4WiflMvRIf2+Z NB9AHs8crLDeW8A5NTa8DsfSDlxyQ9wJRU4FMxQMMM9S5MWGxOGv2aXIbnsOsU7DaY 1waKBqb26aArQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4XjkyZ4F9Mz4xG0; Wed, 6 Nov 2024 10:27:34 +1100 (AEDT) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH 06/12] netlink: RTA_PAYLOAD() returns int, not size_t Date: Wed, 6 Nov 2024 10:25:22 +1100 Message-ID: <20241105232528.1408144-7-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241105232528.1408144-1-david@gibson.dropbear.id.au> References: <20241105232528.1408144-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 2QNDE4E4D2U7RWMDLY2IZBLYT3FXV4XR X-Message-ID-Hash: 2QNDE4E4D2U7RWMDLY2IZBLYT3FXV4XR 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: Since it's the size of a chunk of memory it would seem logical that RTA_PAYLOAD() returns size_t. However, it doesn't - it explicitly casts its result to an int. RTNH_OK(), which often takes the result of RTA_PAYLOAD() as a parameter compares it to an int, so using size_t can result in comparison of different-signed integer warnings from clang. Signed-off-by: David Gibson --- netlink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netlink.c b/netlink.c index 0bdbabf..4aba2a3 100644 --- a/netlink.c +++ b/netlink.c @@ -353,7 +353,7 @@ unsigned int nl_get_ext_if(int s, sa_family_t af) */ bool nl_route_get_def_multipath(struct rtattr *rta, void *gw) { - size_t nh_len = RTA_PAYLOAD(rta); + int nh_len = RTA_PAYLOAD(rta); struct rtnexthop *rtnh; bool found = false; int hops = -1; @@ -582,7 +582,7 @@ int nl_route_dup(int s_src, unsigned int ifi_src, *(unsigned int *)RTA_DATA(rta) = ifi_dst; } else if (rta->rta_type == RTA_MULTIPATH) { - size_t nh_len = RTA_PAYLOAD(rta); + int nh_len = RTA_PAYLOAD(rta); struct rtnexthop *rtnh; for (rtnh = (struct rtnexthop *)RTA_DATA(rta); -- 2.47.0