Linux Hardening
 help / color / mirror / Atom feed
From: Hongbo Li <lihongbo22@huawei.com>
To: <kees@kernel.org>, <andy@kernel.org>, <gregkh@linuxfoundation.org>
Cc: <linux-hardening@vger.kernel.org>
Subject: Re: [PATCH -next v2] lib/string_choices: Add str_true_false()/str_false_true() helper
Date: Sat, 24 Aug 2024 15:04:52 +0800	[thread overview]
Message-ID: <dc6453fb-ed20-415c-b591-cbde4ba69af1@huawei.com> (raw)
In-Reply-To: <20240824070950.2014859-1-lihongbo22@huawei.com>

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

  reply	other threads:[~2024-08-24  7:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2024-08-24  9:18   ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dc6453fb-ed20-415c-b591-cbde4ba69af1@huawei.com \
    --to=lihongbo22@huawei.com \
    --cc=andy@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kees@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox