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: <20241119021719.7659-3-prosunofficial@gmail.com>
Date: Tue, 19 Nov 2024 07:47:19 +0530
From: R Sundar <prosunofficial@...il.com>
To: Kees Cook <kees@...nel.org>,
	Andy Shevchenko <andy@...nel.org>
Cc: linux-hardening@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	R Sundar <prosunofficial@...il.com>,
	Przemek Kitszel <przemyslaw.kitszel@...el.com>
Subject: [PATCH v2 linux-next 2/2] lib/string_choices: Add str_locked_unlocked()/str_unlocked_locked() helper

Add str_locked_unlocked()/str_unlocked_locked() helper to return
"locked" or "unlocked" string literal.

Suggested-by: Przemek Kitszel <przemyslaw.kitszel@...el.com>
Signed-off-by: R Sundar <prosunofficial@...il.com>
---
 include/linux/string_choices.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h
index f3ba4f52ff26..a6bbf4e42c13 100644
--- a/include/linux/string_choices.h
+++ b/include/linux/string_choices.h
@@ -41,6 +41,12 @@ static inline const char *str_high_low(bool v)
 }
 #define str_low_high(v)		str_high_low(!(v))
 
+static inline const char *str_locked_unlocked(bool v)
+{
+	return v ? "locked" : "unlocked";
+}
+#define str_unlocked_locked(v)         str_locked_unlocked(!(v))
+
 static inline const char *str_on_off(bool v)
 {
 	return v ? "on" : "off";
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ