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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dc6453fb-ed20-415c-b591-cbde4ba69af1@huawei.com>
Date: Sat, 24 Aug 2024 15:04:52 +0800
From: Hongbo Li <lihongbo22@...wei.com>
To: <kees@...nel.org>, <andy@...nel.org>, <gregkh@...uxfoundation.org>
CC: <linux-hardening@...r.kernel.org>
Subject: Re: [PATCH -next v2] lib/string_choices: Add
 str_true_false()/str_false_true() helper

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@...wei.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ