On Wed, Dec 02, 2015 at 09:46:51AM -0200, Flavio Leitner wrote:
> On Wed, Dec 02, 2015 at 02:11:16PM +0900, Simon Horman wrote:
> > On Tue, Dec 01, 2015 at 07:50:43PM -0800, Ben Pfaff wrote:
> > > On Wed, Dec 02, 2015 at 10:27:53AM +0900, Simon Horman wrote:
> > > > On Tue, Dec 01, 2015 at 10:39:04AM -0800, Ben Pfaff wrote:
> > > > > Code earlier in this function validated that gm->type is valid, so 
> > > > > there's
> > > > > no need for a default case at the end of the function.  Keeping the 
> > > > > default
> > > > > case as an abort could potentially introduce a bug later, if the code
> > > > > happened to be blindly cut-and-pasted somewhere else.
> > > > > 
> > > > > CC: Flavio Leitner <f...@sysclose.org>
> > > > > Signed-off-by: Ben Pfaff <b...@ovn.org>
> > > > > ---
> > > > >  lib/ofp-util.c | 2 --
> > > > >  1 file changed, 2 deletions(-)
> > > > > 
> > > > > diff --git a/lib/ofp-util.c b/lib/ofp-util.c
> > > > > index 2141144..5a0d31d 100644
> > > > > --- a/lib/ofp-util.c
> > > > > +++ b/lib/ofp-util.c
> > > > > @@ -8879,8 +8879,6 @@ ofputil_decode_group_mod(const struct 
> > > > > ofp_header *oh,
> > > > >                  return OFPERR_OFPGMFC_INVALID_GROUP;
> > > > >              }
> > > > >              break;
> > > > > -        default:
> > > > > -            OVS_NOT_REACHED();
> > > > >          }
> > > > >      }
> > > > 
> > > > My concern is that if it is cut-and pasted without the earlier code
> > > > that verifies gm->type then there may be an case which isn't handled.
> > > > Could we add a comment? In that case I would be comfortable
> > > > with deleting the code though personally I lean towards leaving it.
> 
> Yup.  That's the reason I asked to return the same error as in the
> other switch cases.
> 
> 
> > > I think I'm just going to drop this.  One can't defend against all
> > > coding errors.
> > 
> > I don't feel as strongly about this as my previous email may have implied
> > so feel free to drop it if you think that is reasonable.
>  
> I can send out a patch, no problem.

http://openvswitch.org/pipermail/dev/2015-December/063743.html

fbl


_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to