lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b6b35138-2c37-4b82-894e-59e897ec7d58@kernel.org>
Date: Fri, 2 Jan 2026 23:29:23 +0100
From: Vincent Mailhol <mailhol@...nel.org>
To: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>,
 Nicolas Schier <nicolas@...sle.eu>
Cc: Nathan Chancellor <nathan@...nel.org>, Nicolas Schier <nsc@...nel.org>,
 Nick Desaulniers <nick.desaulniers+lkml@...il.com>,
 Bill Wendling <morbo@...gle.com>, Justin Stitt <justinstitt@...gle.com>,
 Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
 Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
 David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
 Chris Mason <clm@...com>, David Sterba <dsterba@...e.com>,
 Kees Cook <kees@...nel.org>, "Gustavo A. R. Silva" <gustavoars@...nel.org>,
 Linus Torvalds <torvalds@...ux-foundation.org>,
 linux-kbuild@...r.kernel.org, linux-sparse@...r.kernel.org,
 linux-kernel@...r.kernel.org, llvm@...ts.linux.dev,
 dri-devel@...ts.freedesktop.org, linux-btrfs@...r.kernel.org,
 linux-hardening@...r.kernel.org, kernel test robot <lkp@...el.com>
Subject: [PATCH] overflow: Update is_non_negative() and is_negative() comment

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@...il.com>
Link: https://lore.kernel.org/all/CANiq72=jRT+6+2PBgshsK-TpxPiRK70H-+3D6sYaN-fdfC83qw@mail.gmail.com/
Signed-off-by: Vincent Mailhol <mailhol@...nel.org>
---
 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@kernel.org
  */
 #define is_non_negative(a) ((a) > 0 || (a) == 0)
 #define is_negative(a) (!(is_non_negative(a)))
-- 
2.52.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ