Skip to contentSkip to conversation

igc: Make the const read-only array supported_sizes static

PATCH Applied Colin Ian King 4 participants 4 messages Jun 18, 2025 – Jun 19, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 igc: Make the const read-only array supported_sizes static

Don't populate the const read-only array supported_sizes on the stack at run time, instead make it static.

---
 drivers/net/ethernet/intel/igc/igc_tsn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/igc/igc_tsn.c +1 -1
index b23b9ca451a7..8a110145bfee 100644
@@ -431,7 +431,7 @@ static u8 igc_fpe_get_frag_size_mult(const struct igc_fpe_t *fpe)
 
 u32 igc_fpe_get_supported_frag_size(u32 frag_size)
 {
-	const u32 supported_sizes[] = {64, 128, 192, 256};
+	static const u32 supported_sizes[] = { 64, 128, 192, 256 };
 
 	/* Find the smallest supported size that is >= frag_size */
 	for (int i = 0; i < ARRAY_SIZE(supported_sizes); i++) {
Signature · 1 line
2.49.0
Reviewed-by on v1 1/1
#1 lore raw

From: Colin Ian King <[email protected]>
Date: Wed, 18 Jun 2025 14:54:08 +0100

Quoted 4 lines

Don't populate the const read-only array supported_sizes on the stack at run time, instead make it static.

Quoted 9 lines
---
 drivers/net/ethernet/intel/igc/igc_tsn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/igc/igc_tsn.c +0 -0
index b23b9ca451a7..8a110145bfee 100644

drivers/net/ethernet/intel/igc/igc_tsn.c static u8 igc_fpe_get_frag_size_mult(const struct igc_fpe_t *fpe) · line 437

Quoted 8 lines
drivers/net/ethernet/intel/igc/igc_tsn.c +1 -1
@@ -431,7 +431,7 @@ static u8 igc_fpe_get_frag_size_mult(const struct igc_fpe_t *fpe)
 
 u32 igc_fpe_get_supported_frag_size(u32 frag_size)
 {
-	const u32 supported_sizes[] = {64, 128, 192, 256};
+	static const u32 supported_sizes[] = { 64, 128, 192, 256 };
 
 	/* Find the smallest supported size that is >= frag_size */
 	for (int i = 0; i < ARRAY_SIZE(supported_sizes); i++) {

Thanks,
Olek

Reviewed-by
#2 lore raw
Quoted 9 lines · Alexander Lobakin

From: Colin Ian King <[email protected]>
Date: Wed, 18 Jun 2025 14:54:08 +0100

Quoted 4 lines

Don't populate the const read-only array supported_sizes on the stack at run time, instead make it static.

Quoted 20 lines
Quoted 9 lines
---
  drivers/net/ethernet/intel/igc/igc_tsn.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/igc/igc_tsn.c +0 -0
index b23b9ca451a7..8a110145bfee 100644

drivers/net/ethernet/intel/igc/igc_tsn.c static u8 igc_fpe_get_frag_size_mult(const struct igc_fpe_t *fpe) · line 437

Quoted 8 lines
drivers/net/ethernet/intel/igc/igc_tsn.c +1 -1
@@ -431,7 +431,7 @@ static u8 igc_fpe_get_frag_size_mult(const struct igc_fpe_t *fpe)
 
  u32 igc_fpe_get_supported_frag_size(u32 frag_size)
  {
-	const u32 supported_sizes[] = {64, 128, 192, 256};
+	static const u32 supported_sizes[] = { 64, 128, 192, 256 };
 
  	/* Find the smallest supported size that is >= frag_size */
  	for (int i = 0; i < ARRAY_SIZE(supported_sizes); i++) {

Thanks,
Olek

#3 lore raw
In reply to Colin Ian King
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 7 lines · On Wed, 18 Jun 2025 14:54:08 +0100 you wrote:

Don't populate the const read-only array supported_sizes on the stack at run time, instead make it static.

---
 drivers/net/ethernet/intel/igc/igc_tsn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
- igc: Make the const read-only array supported_sizes static

    https://git.kernel.org/netdev/net-next/c/deb21a6e5b4a

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html