On Fri, Oct 15, 2021 at 12:28 PM Ferruh Yigit <[email protected]> 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 <[email protected]>
> Signed-off-by: Ferruh Yigit <[email protected]>

Your fix looks good in any case.

Reviewed-by: David Marchand <[email protected]>


-- 
David Marchand

Reply via email to