Re: [PATCH] overflow: Update is_non_negative() and is_negative() comment
Vincent Mailhol <[email protected]> Sat, 3 Jan 2026 12:10:45 +0100
| Newsgroups | org.kernel.vger.linux-sparse,dev.linux.lists.llvm,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-btrfs,org.kernel.vger.linux-hardening,org.kernel.vger.linux-kbuild,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On 03/01/2026 at 11:02, Dan Carpenter wrote: > Thanks Randy, for sending this to me. I'm on the sparse list, but > I've been on vacation and haven't caught up with my email. Welcome back, hope you enjoyed your holidays! >I can easily silence this in Smatch. Thanks. I ran this locally, I can confirm that this silences the warning. So: Tested-by: Vincent Mailhol <[email protected]> > diff --git a/check_unsigned_lt_zero.c b/check_unsigned_lt_zero.c > index bfeb3261f91d..ac3e650704ce 100644 > --- a/check_unsigned_lt_zero.c > +++ b/check_unsigned_lt_zero.c > @@ -105,7 +105,8 @@ static bool is_allowed_zero(struct expression *expr) > strcmp(macro, "STRTO_H") == 0 || > strcmp(macro, "SUB_EXTEND_USTAT") == 0 || > strcmp(macro, "TEST_CASTABLE_TO_TYPE_VAR") == 0 || > - strcmp(macro, "TEST_ONE_SHIFT") == 0) > + strcmp(macro, "TEST_ONE_SHIFT") == 0 || > + strcmp(macro, "check_shl_overflow") == 0) But, for the long term, wouldn't it better to just ignore all the code coming from macro extensions instead of maintaining this allow-list? > return true; > return false; > } Yours sincerely, Vincent Mailhol