[PATCH] overflow: Update is_non_negative() and is_negative() comment
From: Vincent Mailhol
Date: Fri Jan 02 2026 - 17:29:49 EST
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 <miguel.ojeda.sandonis@xxxxxxxxx>
Link: https://lore.kernel.org/all/CANiq72=jRT+6+2PBgshsK-TpxPiRK70H-+3D6sYaN-fdfC83qw@xxxxxxxxxxxxxx/
Signed-off-by: Vincent Mailhol <mailhol@xxxxxxxxxx>
---
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/acdd84b2-e893-419c-8a46-da55d695dda2@xxxxxxxxxx
*/
#define is_non_negative(a) ((a) > 0 || (a) == 0)
#define is_negative(a) (!(is_non_negative(a)))
--
2.52.0