Re: [PATCH net-next v2] net: vlan: Avoid using BUG() in vlan_proto_idx()

From: David Miller
Date: Fri Sep 25 2020 - 17:12:37 EST


From: Florian Fainelli <f.fainelli@xxxxxxxxx>
Date: Thu, 24 Sep 2020 17:27:44 -0700

> While we should always make sure that we specify a valid VLAN protocol
> to vlan_proto_idx(), killing the machine when an invalid value is
> specified is too harsh and not helpful for debugging. All callers are
> capable of dealing with an error returned by vlan_proto_idx() so check
> the index value and propagate it accordingly.
>
> Signed-off-by: Florian Fainelli <f.fainelli@xxxxxxxxx>
> ---
> Changes in v2:
> - changed signature to return int
> - changed message to use ntohs()
> - renamed an index variable to 'pidx' instead of 'pdix'

Applied, thanks Florian.