All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH -next v2] lib/string_choices: Add str_true_false()/str_false_true() helper
  2024-08-24  7:09 [PATCH -next v2] lib/string_choices: Add str_true_false()/str_false_true() helper Hongbo Li
@ 2024-08-24  7:04 ` Hongbo Li
  2024-08-24  9:18   ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Hongbo Li @ 2024-08-24  7:04 UTC (permalink / raw)
  To: kees, andy, gregkh; +Cc: linux-hardening

As discussed in the previous thread, the coccinelle rules and some 
replacements will be added in the future.

Thanks,
Hongbo

On 2024/8/24 15:09, Hongbo Li wrote:
> Add str_true_false()/str_false_true() helper to return "true" or
> "false" string literal.
> 
> Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
> 
> ---
> v2:
>    - Squash into a single patch as Andy Shevchenko' suggesstion.
> 
> v1:
>    - https://lore.kernel.org/all/1deb2bc4-0cd1-41a0-9434-65c02eef77ed@huawei.com/T/
> ---
>   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 1320bcdcb89c..ebcc56b28ede 100644
> --- a/include/linux/string_choices.h
> +++ b/include/linux/string_choices.h
> @@ -48,6 +48,12 @@ static inline const char *str_up_down(bool v)
>   }
>   #define str_down_up(v)		str_up_down(!(v))
>   
> +static inline const char *str_true_false(bool v)
> +{
> +	return v ? "true" : "false";
> +}
> +#define str_false_true(v)		str_true_false(!(v))
> +
>   /**
>    * str_plural - Return the simple pluralization based on English counts
>    * @num: Number used for deciding pluralization

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

* [PATCH -next v2] lib/string_choices: Add str_true_false()/str_false_true() helper
@ 2024-08-24  7:09 Hongbo Li
  2024-08-24  7:04 ` Hongbo Li
  0 siblings, 1 reply; 3+ messages in thread
From: Hongbo Li @ 2024-08-24  7:09 UTC (permalink / raw)
  To: kees, andy, gregkh; +Cc: lihongbo22, linux-hardening

Add str_true_false()/str_false_true() helper to return "true" or
"false" string literal.

Signed-off-by: Hongbo Li <lihongbo22@huawei.com>

---
v2:
  - Squash into a single patch as Andy Shevchenko' suggesstion.

v1:
  - https://lore.kernel.org/all/1deb2bc4-0cd1-41a0-9434-65c02eef77ed@huawei.com/T/
---
 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 1320bcdcb89c..ebcc56b28ede 100644
--- a/include/linux/string_choices.h
+++ b/include/linux/string_choices.h
@@ -48,6 +48,12 @@ static inline const char *str_up_down(bool v)
 }
 #define str_down_up(v)		str_up_down(!(v))
 
+static inline const char *str_true_false(bool v)
+{
+	return v ? "true" : "false";
+}
+#define str_false_true(v)		str_true_false(!(v))
+
 /**
  * str_plural - Return the simple pluralization based on English counts
  * @num: Number used for deciding pluralization
-- 
2.34.1


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

* Re: [PATCH -next v2] lib/string_choices: Add str_true_false()/str_false_true() helper
  2024-08-24  7:04 ` Hongbo Li
@ 2024-08-24  9:18   ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2024-08-24  9:18 UTC (permalink / raw)
  To: Hongbo Li; +Cc: kees, andy, linux-hardening

On Sat, Aug 24, 2024 at 03:04:52PM +0800, Hongbo Li wrote:
> As discussed in the previous thread, the coccinelle rules and some
> replacements will be added in the future.

Then we have to wait for this one until then.  Remember, we can not take
functions that no one calls, as they will be noticed and someone will
remove them.

Please make a patch series with the function being used, that's the only
way we can actually determine if the addition is correct or not.

thanks,

greg k-h

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

end of thread, other threads:[~2024-08-24  9:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-24  7:09 [PATCH -next v2] lib/string_choices: Add str_true_false()/str_false_true() helper Hongbo Li
2024-08-24  7:04 ` Hongbo Li
2024-08-24  9:18   ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.