diff mbox series

string_choices: Add wrapper for str_down_up()

Message ID 20240812182939.work.424-kees@kernel.org (mailing list archive)
State In Next
Commit f058e2d04606a33fb54b0462b7a270edc918041e
Headers show
Series string_choices: Add wrapper for str_down_up() | expand

Commit Message

Kees Cook Aug. 12, 2024, 6:29 p.m. UTC
The string choice functions which are not clearly true/false synonyms
also have inverted wrappers. Add this for str_down_up() as well.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Kees Cook <kees@kernel.org>
---
Cc: Andy Shevchenko <andy@kernel.org>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: linux-hardening@vger.kernel.org
---
 include/linux/string_choices.h | 1 +
 1 file changed, 1 insertion(+)

Comments

Andy Shevchenko Aug. 12, 2024, 7:49 p.m. UTC | #1
On Mon, Aug 12, 2024 at 11:29:40AM -0700, Kees Cook wrote:
> The string choice functions which are not clearly true/false synonyms
> also have inverted wrappers. Add this for str_down_up() as well.

Reviewed-by: Andy Shevchenko <andy@kernel.org>
diff mbox series

Patch

diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h
index bcde3c9cff81..1320bcdcb89c 100644
--- a/include/linux/string_choices.h
+++ b/include/linux/string_choices.h
@@ -46,6 +46,7 @@  static inline const char *str_up_down(bool v)
 {
 	return v ? "up" : "down";
 }
+#define str_down_up(v)		str_up_down(!(v))
 
 /**
  * str_plural - Return the simple pluralization based on English counts