[PATCH v1] examples/l3fwd: fix for coverity scan

Thomas Monjalon thomas at monjalon.net
Wed Jul 12 16:39:30 CEST 2023


06/07/2023 20:09, Stephen Hemminger:
> On Wed, 01 Feb 2023 18:28:44 +0100
> Thomas Monjalon <thomas at monjalon.net> wrote:
> 
> > 10/01/2023 15:56, Mohammad Iqbal Ahmad:
> > > This patch fixes (Logically dead code) coverity issue.
> > > This patch also fixes (Uninitialized scalar variable) coverity issue.
> > > 
> > > Coverity issue: 381687
> > > Coverity issue: 381686
> > > Fixes: 6a094e328598 ("examples/l3fwd: implement FIB lookup method")
> > > 
> > > Signed-off-by: Mohammad Iqbal Ahmad <mahmad at marvell.com>  
> > 
> > It seems you removed "if (nh != FIB_DEFAULT_HOP)"
> > 
> > Please could you explain what was the issue
> > inside the commit message.
> > It could help to find a better title as well.
> 
> Coverity is spotting that the same condition is evaluated first
> in the if() then in the conditional expression. So yes it is a bug.
> 
> Would prefer the title of
>    examples/l3fwd: fix duplicate expression for default nexthop
> 
> Don't think the default nexthop was ever tested. If it was then
> hops[i] would have never been updated. Probably would just get previous
> value so it worked.
> 
> Acked-by: Stephen Hemminger <stephen at networkplumber.org>

Applied, thanks.





More information about the dev mailing list