[PATCH] overflow: Update is_non_negative() and is_negative() comment
Vincent Mailhol <[email protected]> Fri, 2 Jan 2026 23:29:23 +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]> |
The is_non_negative() and is_negative() function-like macros initially exist as a workaround to silence the -Wtype-limits warning. Now that this warning is disabled, those two macros have lost their raison d'ĂȘtre. Or so we thought. In reality, smatch still produces a similar warning and so, it is unfortunately still too early to undo this workaround. Update the comment to point to smatch instead of GCC's -Wtype-limits. Add a link to the thread in which this was discovered. Suggested-by: Miguel Ojeda <[email protected]> Link: https://lore.kernel.org/all/CANiq72=jRT+6+2PBgshsK-TpxPiRK70H-+3D6sYaN-fdfC83qw@mail.gmail.com/ Signed-off-by: Vincent Mailhol <[email protected]> --- include/linux/overflow.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/overflow.h b/include/linux/overflow.h index 736f633b2d5f..d84194fc783b 100644 --- a/include/linux/overflow.h +++ b/include/linux/overflow.h @@ -37,8 +37,8 @@ #define type_min(t) __type_min(typeof(t)) /* - * Avoids triggering -Wtype-limits compilation warning, - * while using unsigned data types to check a < 0. + * Avoids triggering "unsigned 'a' is never less than zero" smatch warning, + * Link: https://lore.kernel.org/all/[email protected] */ #define is_non_negative(a) ((a) > 0 || (a) == 0) #define is_negative(a) (!(is_non_negative(a))) -- 2.52.0