[PATCH 1/2] net/i40e: compilation fix for GCC-12

Thomas Monjalon thomas at monjalon.net
Thu Oct 6 11:51:15 CEST 2022


24/08/2022 16:03, Amit Prakash Shukla:
> GCC 12 raises the following warning:
> 
> meson --werror --buildtype=debugoptimized
> 	--cross-file config/x86/cross-mingw -Dexamples=helloworld build
> ninja -C build
> 
> In function 'i40e_hash_get_pattern_type',
>     inlined from 'i40e_hash_get_pattern_pctypes' at
> ../drivers/net/i40e/i40e_hash.c:520:8,
>     inlined from 'i40e_hash_parse_pattern_act' at
> ../drivers/net/i40e/i40e_hash.c:1147:9,
>     inlined from 'i40e_hash_parse' at
> ../drivers/net/i40e/i40e_hash.c:1181:9:
> ../drivers/net/i40e/i40e_hash.c:389:47:
> 	error: array subscript 53 is above array
> 	bounds of 'const uint64_t[53]'
> 	{aka 'const long long unsigned int[53]'} [-Werror=array-bounds]
>   389 |                 item_hdr = pattern_item_header[last_item_type];
>       |                            ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
> ../drivers/net/i40e/i40e_hash.c: In function 'i40e_hash_parse':
> ../drivers/net/i40e/i40e_hash.c:182:23: note: while referencing
> 'pattern_item_header'
>   182 | static const uint64_t pattern_item_header[] = {
>       |                       ^~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> 
> Fixes: ef4c16fd9148 (net/i40e: refactor RSS flow)
> Cc: stable at dpdk.org
> 
> Signed-off-by: Amit Prakash Shukla <amitprakashs at marvell.com>

Sorry I did not notice this patch and I recently submitted one
which I will abandon.
It seems there was no reply from i40e maintainers after 6 weeks,
but I will apply anyway.

I will use my commit message:

    net/i40e: fix build with MinGW GCC 12
    
    When compiling with MinGW GCC 12,
    the rte_flow_item array is seen as read out of bound:
    
    net/i40e/i40e_hash.c:389:47: error:
    	array subscript 50 is above array bounds of ‘const uint64_t[50]’
    	{aka ‘const long long unsigned int[50]’} [-Werror=array-bounds]
    	389 | item_hdr = pattern_item_header[last_item_type];
    	    |            ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
    
    It seems the assert check done above this line has no impact.
    A real check is added to make the compiler happy.
    
    Fixes: ef4c16fd9148 ("net/i40e: refactor RSS flow")
    Cc: stable at dpdk.org





More information about the stable mailing list