[dpdk-dev] [PATCH] net/enic: fix build with GCC 7.5

Ferruh Yigit ferruh.yigit at intel.com
Mon Oct 18 17:55:15 CEST 2021


On 10/18/2021 12:16 PM, Ferruh Yigit wrote:
> On 10/15/2021 12:16 PM, David Marchand wrote:
>> On Fri, Oct 15, 2021 at 12:28 PM Ferruh Yigit <ferruh.yigit at intel.com> wrote:
>>>
>>> Build error:
>>> ../drivers/net/enic/enic_fm_flow.c: In function 'enic_fm_flow_parse':
>>> ../drivers/net/enic/enic_fm_flow.c:1467:24:
>>>          error: 'dev' may be used uninitialized in this function
>>>          [-Werror=maybe-uninitialized]
>>>      struct rte_eth_dev *dev;
>>>                          ^~~
>>> ../drivers/net/enic/enic_fm_flow.c:1580:24:
>>>          error: 'dev' may be used uninitialized in this function
>>>          [-Werror=maybe-uninitialized]
>>>      struct rte_eth_dev *dev;
>>>                          ^~~
>>> ../drivers/net/enic/enic_fm_flow.c:1599:24:
>>>          error: 'dev' may be used uninitialized in this function
>>>          [-Werror=maybe-uninitialized]
>>>      struct rte_eth_dev *dev;
>>>                          ^~~
>>>
>>> Build error looks like false positive, but to silence the compiler
>>> initializing the pointer with NULL.
>>
>> enic_fm_check_transfer_dst() contains branches where dev is not set
>> and those branches return rte_flow_error_set return value.
>> dev is dereferenced later based on this return value == 0.
>>
>> So the compiler probably thinks that rte_flow_error_set may return 0.
>> rte_flow_error_set is outside of compiler "view" at the moment it
>> compiles enic_fm_flow.c, so the compiler making the assumption this
>> function can return 0 is being prudent from my pov.
>>
>>
>>>
>>> Fixes: 7968917ccf64 ("net/enic: support meta flow actions to overrule destinations")
>>>
>>> Reported-by: David Marchand <david.marchand at redhat.com>
>>> Signed-off-by: Ferruh Yigit <ferruh.yigit at intel.com>
>>
>> Your fix looks good in any case.
>>
>> Reviewed-by: David Marchand <david.marchand at redhat.com>
>>
> 
> Applied to dpdk-next-net/main, thanks.
> 

     Bugzilla ID: 812

Updated in next-net.


More information about the dev mailing list