Re: [PATCH] bpf: fix netfilter link comparison to handle unsigned flags
From: Haofeng Li
Date: Sun Sep 21 2025 - 21:51:58 EST
Thank you for your review and feedback.
>Did you actually observe an overflow producing an error when sorting,
>here? Or did you run into some compiler warning?
I did not encounter a runtime error or a compiler warning caused by this potential overflow.
The issue was identified during code review as a potential risk,
considering the theoretical possibility of wrap-around with unsigned subtraction,
which prompted me to submit this patch for code robustness.
>This being said, I don't mind making the code cleaner for these
>comparisons, but we should probably treat all three attributes the same,
>and update the rest of the function as well?
Thank you for pointing this out.
I will prepare a v2 patch that thoroughly reviews and updates the comparison
logic for all three fields (netfilter.pf, netfilter.hooknum, and netfilter.flags),
replacing all subtraction-based comparisons with explicit conditional checks.
This will ensure the entire comparison function is robust and consistent in its behavior.
Best regards,
Haofeng Li