[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAADnVQLJBDO5e_U-9SxQ6RxUGLUALVk1_TuJaqdJFmjf2XOTJg@mail.gmail.com>
Date: Sun, 21 Sep 2025 19:21:12 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Haofeng Li <920484857@...com>
Cc: Quentin Monnet <qmo@...nel.org>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>, Andrii Nakryiko <andrii@...nel.org>,
LKML <linux-kernel@...r.kernel.org>, Haofeng Li <13266079573@....com>,
lihaofeng <lihaofeng@...inos.cn>
Subject: Re: [PATCH v2] bpf: fix netfilter link comparison to handle unsigned flags
On Sun, Sep 21, 2025 at 7:17 PM Haofeng Li <920484857@...com> wrote:
>
> From: lihaofeng <lihaofeng@...inos.cn>
>
> The original implementation of netfilter_link_compar() used subtraction
> to compare the netfilter.flags field, which is an unsigned type.
> This could result in incorrect comparison results when the unsigned
> value wrapped around due to underflow.
>
> Changed the comparison logic for flags to use explicit conditional
> checks (similar to how priority is handled) instead of subtraction,
> ensuring correct negative/zero/positive return values regardless of
> the underlying data type.
>
> This fixes potential sorting issues when using this comparison function
> with algorithms like qsort() or bsearch().
>
> Signed-off-by: lihaofeng <lihaofeng@...inos.cn>
Nack. We don't fix theoretical issues.
pw-bot: cr
Powered by blists - more mailing lists