[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241230093709.3226854-1-buaajxlj@163.com>
Date: Mon, 30 Dec 2024 17:37:09 +0800
From: Liang Jie <buaajxlj@....com>
To: kuba@...nel.org,
ecree.xilinx@...il.com
Cc: habetsm.xilinx@...il.com,
andrew+netdev@...n.ch,
davem@...emloft.net,
edumazet@...gle.com,
pabeni@...hat.com,
horms@...nel.org,
pieter.jansen-van-vuuren@....com,
netdev@...r.kernel.org,
linux-net-drivers@....com,
linux-kernel@...r.kernel.org,
Liang Jie <liangjie@...iang.com>
Subject: [PATCH net] net: sfc: Correct key_len for efx_tc_ct_zone_ht_params
From: Liang Jie <liangjie@...iang.com>
In efx_tc_ct_zone_ht_params, the key_len was previously set to
offsetof(struct efx_tc_ct_zone, linkage). This calculation is incorrect
because it includes any padding between the zone field and the linkage
field due to structure alignment, which can vary between systems.
This patch updates key_len to use sizeof_field(struct efx_tc_ct_zone, zone)
, ensuring that the hash table correctly uses the zone as the key. This fix
prevents potential hash lookup errors and improves connection tracking
reliability.
Fixes: c3bb5c6acd4e ("sfc: functions to register for conntrack zone offload")
Signed-off-by: Liang Jie <liangjie@...iang.com>
---
drivers/net/ethernet/sfc/tc_conntrack.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/sfc/tc_conntrack.c b/drivers/net/ethernet/sfc/tc_conntrack.c
index d90206f27161..c0603f54cec3 100644
--- a/drivers/net/ethernet/sfc/tc_conntrack.c
+++ b/drivers/net/ethernet/sfc/tc_conntrack.c
@@ -16,7 +16,7 @@ static int efx_tc_flow_block(enum tc_setup_type type, void *type_data,
void *cb_priv);
static const struct rhashtable_params efx_tc_ct_zone_ht_params = {
- .key_len = offsetof(struct efx_tc_ct_zone, linkage),
+ .key_len = sizeof_field(struct efx_tc_ct_zone, zone),
.key_offset = 0,
.head_offset = offsetof(struct efx_tc_ct_zone, linkage),
};
--
2.25.1
Powered by blists - more mailing lists