[PATCH v2 net-next] ipvlan: Fix sparse warning about __be32 -> u32

Dmitry Skorodumov posted 1 patch 1 week, 4 days ago
drivers/net/ipvlan/ipvlan_core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH v2 net-next] ipvlan: Fix sparse warning about __be32 -> u32
Posted by Dmitry Skorodumov 1 week, 4 days ago
Fixed a sparse warning:

ipvlan_core.c:56: warning: incorrect type in argument 1
(different base types) expected unsigned int [usertype] a
got restricted __be32 const [usertype] s_addr

Force cast the s_addr to u32

Fixes: 2ad7bf363841 ("ipvlan: Initial check-in of the IPVLAN driver.")
Signed-off-by: Dmitry Skorodumov <skorodumov.dmitry@huawei.com>
---
 drivers/net/ipvlan/ipvlan_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c
index d7e3ddbcab6f..dea411e132db 100644
--- a/drivers/net/ipvlan/ipvlan_core.c
+++ b/drivers/net/ipvlan/ipvlan_core.c
@@ -52,8 +52,8 @@ static u8 ipvlan_get_v4_hash(const void *iaddr)
 {
 	const struct in_addr *ip4_addr = iaddr;
 
-	return jhash_1word(ip4_addr->s_addr, ipvlan_jhash_secret) &
-	       IPVLAN_HASH_MASK;
+	return jhash_1word((__force u32)ip4_addr->s_addr, ipvlan_jhash_secret) &
+			   IPVLAN_HASH_MASK;
 }
 
 static bool addr_equal(bool is_v6, struct ipvl_addr *addr, const void *iaddr)
-- 
2.25.1
Re: [PATCH v2 net-next] ipvlan: Fix sparse warning about __be32 -> u32
Posted by Jakub Kicinski 1 week, 4 days ago
On Thu, 20 Nov 2025 20:26:32 +0300 Dmitry Skorodumov wrote:
> Fixed a sparse warning:
> 
> ipvlan_core.c:56: warning: incorrect type in argument 1
> (different base types) expected unsigned int [usertype] a
> got restricted __be32 const [usertype] s_addr
> 
> Force cast the s_addr to u32
> 
> Fixes: 2ad7bf363841 ("ipvlan: Initial check-in of the IPVLAN driver.")
> Signed-off-by: Dmitry Skorodumov <skorodumov.dmitry@huawei.com>

Read this please:
https://www.kernel.org/doc/html/next/process/maintainer-netdev.html

v1 was fine, why are you adding a Fixes tag in a non-functional change
:| I can't dig out v1 now because k.org aggressively supersedes the
patches. Send a v3 *while following the rules*.
-- 
pw-bot: cr