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] [thread-next>] [day] [month] [year] [list]
Message-Id: <1444925909-6013-2-git-send-email-martink@posteo.de>
Date:	Thu, 15 Oct 2015 18:18:28 +0200
From:	Martin Kepplinger <martink@...teo.de>
To:	mingo@...nel.org, akpm@...ux-foundation.org, linux@...izon.com,
	linux@...musvillemoes.dk, maxime.coquelin@...com,
	dvlasenk@...hat.com, yury.norov@...il.com,
	torvalds@...ux-foundation.org
Cc:	linux-kernel@...r.kernel.org,
	Martin Kepplinger <martink@...teo.de>,
	Martin Kepplinger <martin.kepplinger@...obroma-systems.com>
Subject: [PATCH 1/2] bitops.h: Improve sign_extend32()'s documentation

It is often overlooked that sign_extend32(), despite it's name, is safe
to use for 16 and 8 bit types aswell. This should help that sign extension
isn't done manually some other way.

Signed-off-by: Martin Kepplinger <martin.kepplinger@...obroma-systems.com>
---
 include/linux/bitops.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index e635533..2177c01 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -164,6 +164,8 @@ static inline __u8 ror8(__u8 word, unsigned int shift)
  * sign_extend32 - sign extend a 32-bit value using specified bit as sign-bit
  * @value: value to sign extend
  * @index: 0 based bit index (0<=index<32) to sign bit
+ *
+ * This is safe to use for 16- and 8-bit types aswell.
  */
 static inline __s32 sign_extend32(__u32 value, int index)
 {
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ