[PATCH] igc: Make the const read-only array supported_sizes static

Colin Ian King posted 1 patch 3 months, 3 weeks ago
drivers/net/ethernet/intel/igc/igc_tsn.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] igc: Make the const read-only array supported_sizes static
Posted by Colin Ian King 3 months, 3 weeks ago
Don't populate the const read-only array supported_sizes on the
stack at run time, instead make it static.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/net/ethernet/intel/igc/igc_tsn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/igc/igc_tsn.c b/drivers/net/ethernet/intel/igc/igc_tsn.c
index b23b9ca451a7..8a110145bfee 100644
--- a/drivers/net/ethernet/intel/igc/igc_tsn.c
+++ b/drivers/net/ethernet/intel/igc/igc_tsn.c
@@ -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++) {
-- 
2.49.0
Re: [Intel-wired-lan] [PATCH] igc: Make the const read-only array supported_sizes static
Posted by Alexander Lobakin 3 months, 3 weeks ago
From: Colin Ian King <colin.i.king@gmail.com>
Date: Wed, 18 Jun 2025 14:54:08 +0100

> Don't populate the const read-only array supported_sizes on the
> stack at run time, instead make it static.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>

> ---
>  drivers/net/ethernet/intel/igc/igc_tsn.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/igc/igc_tsn.c b/drivers/net/ethernet/intel/igc/igc_tsn.c
> index b23b9ca451a7..8a110145bfee 100644
> --- a/drivers/net/ethernet/intel/igc/igc_tsn.c
> +++ b/drivers/net/ethernet/intel/igc/igc_tsn.c
> @@ -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
Re: [Intel-wired-lan] [PATCH] igc: Make the const read-only array supported_sizes static
Posted by Lifshits, Vitaly 3 months, 3 weeks ago

On 6/18/2025 7:29 PM, Alexander Lobakin wrote:
> From: Colin Ian King <colin.i.king@gmail.com>
> Date: Wed, 18 Jun 2025 14:54:08 +0100
> 
>> Don't populate the const read-only array supported_sizes on the
>> stack at run time, instead make it static.
>>
>> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> 
> Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Reviewed-by: Vitaly Lifshits <vitaly.lifshits@intel.com>>
>> ---
>>   drivers/net/ethernet/intel/igc/igc_tsn.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/intel/igc/igc_tsn.c b/drivers/net/ethernet/intel/igc/igc_tsn.c
>> index b23b9ca451a7..8a110145bfee 100644
>> --- a/drivers/net/ethernet/intel/igc/igc_tsn.c
>> +++ b/drivers/net/ethernet/intel/igc/igc_tsn.c
>> @@ -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