Re: [PATCH 1/1] common/sfc_efx/base: remove unreachable code
Ariel Otilibili-Anieli
otilibil at eurecom.fr
Sat Dec 21 19:20:21 CET 2024
On Saturday, December 21, 2024 18:42 CET, Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru> wrote:
> NACK
>
> it is the base driver and corresponding code is unreachable with current
> build options only.
Hello Andrew,
Thanks for having looked into this. It looks indeed like a false positive:
```
$ awk 'NR>67 && NR<88 {print NR ":" $0}' drivers/common/sfc_efx/base/efx_mon.c
68:
69: EFSYS_ASSERT(encp->enc_mon_type != EFX_MON_INVALID);
70: switch (emp->em_type) {
71:#if EFSYS_OPT_MON_MCDI
72: case EFX_MON_SFC90X0:
73: case EFX_MON_SFC91X0:
74: case EFX_MON_SFC92X0:
75: emop = &__efx_mon_mcdi_ops;
76: break;
77:#endif
78: default:
79: rc = ENOTSUP;
80: goto fail2;
81: }
82:
83: emp->em_emop = emop;
84: return (0);
85:
86:fail2:
87: EFSYS_PROBE(fail2);
```
This is the update I made in Coverity:
If EFSYS_OPT_MON_MCDI is enabled; and emp->em_type is any of EFX_MON_SFC90X0, EFX_MON_SFC91X0, or EFX_MON_SFC92X0; Lignes 82 and 83 are reached.
Regards,
Ariel
>
> On 12/21/24 16:27, Ariel Otilibili wrote:
> > The default switch case ends with a goto; meaning these instructions are
> > never reached.
> >
> > Coverity issue: 121742
> > Fixes: 19b64c6ac3 ("net/sfc/base: import libefx base")
> > Signed-off-by: Ariel Otilibili <otilibil at eurecom.fr>
> > --
> > Cc: stable at dpdk.org
> > Cc: Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>
> > ---
> > drivers/common/sfc_efx/base/efx_mon.c | 3 ---
> > 1 file changed, 3 deletions(-)
> >
> > diff --git a/drivers/common/sfc_efx/base/efx_mon.c b/drivers/common/sfc_efx/base/efx_mon.c
> > index ee449ef5eb..5706171abd 100644
> > --- a/drivers/common/sfc_efx/base/efx_mon.c
> > +++ b/drivers/common/sfc_efx/base/efx_mon.c
> > @@ -80,9 +80,6 @@ efx_mon_init(
> > goto fail2;
> > }
> >
> > - emp->em_emop = emop;
> > - return (0);
> > -
> > fail2:
> > EFSYS_PROBE(fail2);
> >
>
More information about the stable
mailing list