mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net] net: sfc: Correct key_len for efx_tc_ct_zone_ht_params
@ 2024-12-30  9:37 Liang Jie
  2025-01-02 15:36 ` Edward Cree
  2025-01-03  2:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Liang Jie @ 2024-12-30  9:37 UTC (permalink / raw)
  To: kuba, ecree.xilinx
  Cc: habetsm.xilinx, andrew+netdev, davem, edumazet, pabeni, horms,
	pieter.jansen-van-vuuren, netdev, linux-net-drivers,
	linux-kernel, Liang Jie

From: Liang Jie <liangjie@lixiang.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@lixiang.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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: sfc: Correct key_len for efx_tc_ct_zone_ht_params
  2024-12-30  9:37 [PATCH net] net: sfc: Correct key_len for efx_tc_ct_zone_ht_params Liang Jie
@ 2025-01-02 15:36 ` Edward Cree
  2025-01-03  2:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Edward Cree @ 2025-01-02 15:36 UTC (permalink / raw)
  To: Liang Jie, kuba
  Cc: habetsm.xilinx, andrew+netdev, davem, edumazet, pabeni, horms,
	pieter.jansen-van-vuuren, netdev, linux-net-drivers,
	linux-kernel, Liang Jie

On 30/12/2024 09:37, Liang Jie wrote:
> From: Liang Jie <liangjie@lixiang.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@lixiang.com>

Thanks.

Acked-by: Edward Cree <ecree.xilinx@gmail.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: sfc: Correct key_len for efx_tc_ct_zone_ht_params
  2024-12-30  9:37 [PATCH net] net: sfc: Correct key_len for efx_tc_ct_zone_ht_params Liang Jie
  2025-01-02 15:36 ` Edward Cree
@ 2025-01-03  2:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-01-03  2:20 UTC (permalink / raw)
  To: Liang Jie
  Cc: kuba, ecree.xilinx, habetsm.xilinx, andrew+netdev, davem,
	edumazet, pabeni, horms, pieter.jansen-van-vuuren, netdev,
	linux-net-drivers, linux-kernel, liangjie

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 30 Dec 2024 17:37:09 +0800 you wrote:
> From: Liang Jie <liangjie@lixiang.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.
> 
> [...]

Here is the summary with links:
  - [net] net: sfc: Correct key_len for efx_tc_ct_zone_ht_params
    https://git.kernel.org/netdev/net/c/a8620de72e56

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-01-03  2:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-30  9:37 [PATCH net] net: sfc: Correct key_len for efx_tc_ct_zone_ht_params Liang Jie
2025-01-02 15:36 ` Edward Cree
2025-01-03  2:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome