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-next>] [day] [month] [year] [list]
Message-ID: <9b872036-42ce-2d08-2e98-12bf0abf7095@axentia.se>
Date:   Tue, 23 May 2023 14:16:30 +0200
From:   Peter Rosin <peda@...ntia.se>
To:     LKML <linux-kernel@...r.kernel.org>
Cc:     Jakub Kicinski <kuba@...nel.org>,
        Dinan Gunawardena <dinan.gunawardena@...ronome.com>,
        Kalle Valo <kvalo@...nel.org>,
        Johannes Berg <johannes.berg@...el.com>
Subject: [PATCH] bitfield: suggest using bitwise OR when combining bitfields

Logical OR fails to deliver the desired result. Most of the time.

Fixes: 3e9b3112ec74 ("add basic register-field manipulation macros")
Fixes: e2192de59e45 ("bitfield: add FIELD_PREP_CONST()")
Signed-off-by: Peter Rosin <peda@...ntia.se>
---
 include/linux/bitfield.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/bitfield.h b/include/linux/bitfield.h
index ebfa12f69501..d70fc96585e2 100644
--- a/include/linux/bitfield.h
+++ b/include/linux/bitfield.h
@@ -107,7 +107,7 @@
  * @_val:  value to put in the field
  *
  * FIELD_PREP() masks and shifts up the value.  The result should
- * be combined with other fields of the bitfield using logical OR.
+ * be combined with other fields of the bitfield using bitwise OR.
  */
 #define FIELD_PREP(_mask, _val)						\
 	({								\
@@ -123,7 +123,7 @@
  * @_val:  value to put in the field
  *
  * FIELD_PREP_CONST() masks and shifts up the value.  The result should
- * be combined with other fields of the bitfield using logical OR.
+ * be combined with other fields of the bitfield using bitwise OR.
  *
  * Unlike FIELD_PREP() this is a constant expression and can therefore
  * be used in initializers. Error checking is less comfortable for this
-- 
2.20.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ