lkml.org 
[lkml]   [2022]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH net-next v2 2/4] net: skb: check the boundrary of drop reason in kfree_skb_reason()
On Fri, May 13, 2022 at 12:16 AM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Thu, 12 May 2022 20:33:11 +0800 menglong8.dong@gmail.com 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?

Yeah, it seems this way is more logical. I'll change it in the V3.

\
 
 \ /
  Last update: 2022-05-13 04:42    [W:1.116 / U:0.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site