public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] string_choices: Add wrapper for str_down_up()
@ 2024-08-12 18:29 Kees Cook
  2024-08-12 19:49 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Kees Cook @ 2024-08-12 18:29 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Kees Cook, Andy Shevchenko, Michal Wajdeczko, linux-hardening,
	linux-kernel

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(+)

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
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] string_choices: Add wrapper for str_down_up()
  2024-08-12 18:29 [PATCH] string_choices: Add wrapper for str_down_up() Kees Cook
@ 2024-08-12 19:49 ` Andy Shevchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2024-08-12 19:49 UTC (permalink / raw)
  To: Kees Cook; +Cc: Michal Wajdeczko, linux-hardening, linux-kernel

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>

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-08-12 19:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-12 18:29 [PATCH] string_choices: Add wrapper for str_down_up() Kees Cook
2024-08-12 19:49 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox