public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: txgbe: leave space for null terminators on property_entry
@ 2026-04-05 22:20 Fabio Baltieri
  2026-04-08  7:40 ` Jiawen Wu
  2026-04-09  2:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Fabio Baltieri @ 2026-04-05 22:20 UTC (permalink / raw)
  To: Jiawen Wu, Mengyuan Lou, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman
  Cc: Fabio Baltieri, netdev, linux-kernel

Lists of struct property_entry are supposed to be terminated with an
empty property, this driver currently seems to be allocating exactly the
amount of entry used.

Change the struct definition to leave an extra element for all
property_entry.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
---

Hi, bumped into this while studying the code, looks like the struct has
been allocated without space for terminators, guess the top ones just
end up using the bottom props as well but I'm surprised this does not
crash at some point. Build test only, don't have any hardware for this,
let me know if I'm missing something here.

Cheers,
Fabio

 drivers/net/ethernet/wangxun/txgbe/txgbe_type.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_type.h b/drivers/net/ethernet/wangxun/txgbe/txgbe_type.h
index 82433e9cb0e3..6b05f32b4a01 100644
--- a/drivers/net/ethernet/wangxun/txgbe/txgbe_type.h
+++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_type.h
@@ -424,10 +424,10 @@ struct txgbe_nodes {
 	char i2c_name[32];
 	char sfp_name[32];
 	char phylink_name[32];
-	struct property_entry gpio_props[1];
-	struct property_entry i2c_props[3];
-	struct property_entry sfp_props[8];
-	struct property_entry phylink_props[2];
+	struct property_entry gpio_props[2];
+	struct property_entry i2c_props[4];
+	struct property_entry sfp_props[9];
+	struct property_entry phylink_props[3];
 	struct software_node_ref_args i2c_ref[1];
 	struct software_node_ref_args gpio0_ref[1];
 	struct software_node_ref_args gpio1_ref[1];
-- 
2.47.3


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

* RE: [PATCH] net: txgbe: leave space for null terminators on property_entry
  2026-04-05 22:20 [PATCH] net: txgbe: leave space for null terminators on property_entry Fabio Baltieri
@ 2026-04-08  7:40 ` Jiawen Wu
  2026-04-09  2:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Jiawen Wu @ 2026-04-08  7:40 UTC (permalink / raw)
  To: 'Fabio Baltieri', 'Mengyuan Lou',
	'Andrew Lunn', 'David S. Miller',
	'Eric Dumazet', 'Jakub Kicinski',
	'Paolo Abeni', 'Simon Horman',
	'Mengyuan Lou', 'Andrew Lunn',
	'David S. Miller', 'Eric Dumazet',
	'Jakub Kicinski', 'Paolo Abeni',
	'Simon Horman'
  Cc: netdev, linux-kernel

> Lists of struct property_entry are supposed to be terminated with an
> empty property, this driver currently seems to be allocating exactly the
> amount of entry used.
> 
> Change the struct definition to leave an extra element for all
> property_entry.
> 
> Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
> ---
> 
> Hi, bumped into this while studying the code, looks like the struct has
> been allocated without space for terminators, guess the top ones just
> end up using the bottom props as well but I'm surprised this does not
> crash at some point. Build test only, don't have any hardware for this,
> let me know if I'm missing something here.
> 
> Cheers,
> Fabio
> 
>  drivers/net/ethernet/wangxun/txgbe/txgbe_type.h | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_type.h b/drivers/net/ethernet/wangxun/txgbe/txgbe_type.h
> index 82433e9cb0e3..6b05f32b4a01 100644
> --- a/drivers/net/ethernet/wangxun/txgbe/txgbe_type.h
> +++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_type.h
> @@ -424,10 +424,10 @@ struct txgbe_nodes {
>  	char i2c_name[32];
>  	char sfp_name[32];
>  	char phylink_name[32];
> -	struct property_entry gpio_props[1];
> -	struct property_entry i2c_props[3];
> -	struct property_entry sfp_props[8];
> -	struct property_entry phylink_props[2];
> +	struct property_entry gpio_props[2];
> +	struct property_entry i2c_props[4];
> +	struct property_entry sfp_props[9];
> +	struct property_entry phylink_props[3];
>  	struct software_node_ref_args i2c_ref[1];
>  	struct software_node_ref_args gpio0_ref[1];
>  	struct software_node_ref_args gpio1_ref[1];
> --
> 2.47.3

Tested-by: Jiawen Wu <jiawenwu@trustnetic.com>



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

* Re: [PATCH] net: txgbe: leave space for null terminators on property_entry
  2026-04-05 22:20 [PATCH] net: txgbe: leave space for null terminators on property_entry Fabio Baltieri
  2026-04-08  7:40 ` Jiawen Wu
@ 2026-04-09  2:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-04-09  2:20 UTC (permalink / raw)
  To: Fabio Baltieri
  Cc: jiawenwu, mengyuanlou, andrew+netdev, davem, edumazet, kuba,
	pabeni, horms, netdev, linux-kernel

Hello:

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

On Sun,  5 Apr 2026 23:20:13 +0100 you wrote:
> Lists of struct property_entry are supposed to be terminated with an
> empty property, this driver currently seems to be allocating exactly the
> amount of entry used.
> 
> Change the struct definition to leave an extra element for all
> property_entry.
> 
> [...]

Here is the summary with links:
  - net: txgbe: leave space for null terminators on property_entry
    https://git.kernel.org/netdev/net/c/5a37d228799b

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:[~2026-04-09  2:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-05 22:20 [PATCH] net: txgbe: leave space for null terminators on property_entry Fabio Baltieri
2026-04-08  7:40 ` Jiawen Wu
2026-04-09  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