2022-05-12 21:44:18

by Eric Dumazet

[permalink] [raw]
Subject: Re: [PATCH net-next v2 2/4] net: skb: check the boundrary of drop reason in kfree_skb_reason()

On Thu, May 12, 2022 at 9:16 AM Jakub Kicinski <[email protected]> wrote:
>
> On Thu, 12 May 2022 20:33:11 +0800 [email protected] wrote:
> > + if (unlikely(reason <= 0 || reason >= SKB_DROP_REASON_MAX)) {
> > + DEBUG_NET_WARN_ON_ONCE(1);
> > + reason = SKB_DROP_REASON_NOT_SPECIFIED;
> > + }
>
> With drop_monitor fixes sending an invalid reason to the tracepoint
> should be a minor bug, right?
>
> Can we just have a:
>
> DEBUG_NET_WARN_ON_ONCE(reason <= 0 || reason >= SKB_DROP_REASON_MAX);
>
> and avoid having this branch on non-debug builds?

Exactly what I was going to say.