Linux Hardening
 help / color / mirror / Atom feed
* [PATCH v2 linux-next 0/2] lib/string_choices: Sorting function order
@ 2024-11-19  2:17 R Sundar
  2024-11-19  2:17 ` [PATCH v2 linux-next 1/2] lib/string_choices: Rearrange functions in sorted order R Sundar
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: R Sundar @ 2024-11-19  2:17 UTC (permalink / raw)
  To: Kees Cook, Andy Shevchenko; +Cc: linux-hardening, linux-kernel, R Sundar

This patch series rearrange misplaced functions in sorted order and add 
str_locked_unlocked() helper.

Signed-off-by: R Sundar <prosunofficial@gmail.com>                              
---                                                                             
                                                                                
Changes in v2: Rearrange functions in sorted order as seperate patch.           
                                                                                
Changes in v1: Add str_locked_unlocked helper function alone.                   
link to v1: https://lore.kernel.org/all/20241115144616.7453-1-prosunofficial@gmail.com/
---  

R Sundar (2):
  lib/string_choices: Rearrange functions in sorted order
  lib/string_choices: Add str_locked_unlocked()/str_unlocked_locked()
    helper

 include/linux/string_choices.h | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

-- 
2.34.1


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

* [PATCH v2 linux-next 1/2] lib/string_choices: Rearrange functions in sorted order
  2024-11-19  2:17 [PATCH v2 linux-next 0/2] lib/string_choices: Sorting function order R Sundar
@ 2024-11-19  2:17 ` R Sundar
  2025-01-14 12:33   ` Larysa Zaremba
  2025-03-03 17:17   ` (subset) " Kees Cook
  2024-11-19  2:17 ` [PATCH v2 linux-next 2/2] lib/string_choices: Add str_locked_unlocked()/str_unlocked_locked() helper R Sundar
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 8+ messages in thread
From: R Sundar @ 2024-11-19  2:17 UTC (permalink / raw)
  To: Kees Cook, Andy Shevchenko
  Cc: linux-hardening, linux-kernel, R Sundar, Andy Shevchenko

Rearrange misplaced functions in sorted order.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: R Sundar <prosunofficial@gmail.com>
---
 include/linux/string_choices.h | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h
index 120ca0f28e95..f3ba4f52ff26 100644
--- a/include/linux/string_choices.h
+++ b/include/linux/string_choices.h
@@ -41,23 +41,23 @@ static inline const char *str_high_low(bool v)
 }
 #define str_low_high(v)		str_high_low(!(v))
 
-static inline const char *str_read_write(bool v)
-{
-	return v ? "read" : "write";
-}
-#define str_write_read(v)		str_read_write(!(v))
-
 static inline const char *str_on_off(bool v)
 {
 	return v ? "on" : "off";
 }
 #define str_off_on(v)		str_on_off(!(v))
 
-static inline const char *str_yes_no(bool v)
+static inline const char *str_read_write(bool v)
 {
-	return v ? "yes" : "no";
+	return v ? "read" : "write";
 }
-#define str_no_yes(v)		str_yes_no(!(v))
+#define str_write_read(v)		str_read_write(!(v))
+
+static inline const char *str_true_false(bool v)
+{
+	return v ? "true" : "false";
+}
+#define str_false_true(v)		str_true_false(!(v))
 
 static inline const char *str_up_down(bool v)
 {
@@ -65,11 +65,11 @@ 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)
+static inline const char *str_yes_no(bool v)
 {
-	return v ? "true" : "false";
+	return v ? "yes" : "no";
 }
-#define str_false_true(v)		str_true_false(!(v))
+#define str_no_yes(v)		str_yes_no(!(v))
 
 /**
  * str_plural - Return the simple pluralization based on English counts
-- 
2.34.1


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

* [PATCH v2 linux-next 2/2] lib/string_choices: Add str_locked_unlocked()/str_unlocked_locked() helper
  2024-11-19  2:17 [PATCH v2 linux-next 0/2] lib/string_choices: Sorting function order R Sundar
  2024-11-19  2:17 ` [PATCH v2 linux-next 1/2] lib/string_choices: Rearrange functions in sorted order R Sundar
@ 2024-11-19  2:17 ` R Sundar
  2024-11-19  8:35 ` [PATCH v2 linux-next 0/2] lib/string_choices: Sorting function order Andy Shevchenko
  2025-01-13 15:49 ` Andy Shevchenko
  3 siblings, 0 replies; 8+ messages in thread
From: R Sundar @ 2024-11-19  2:17 UTC (permalink / raw)
  To: Kees Cook, Andy Shevchenko
  Cc: linux-hardening, linux-kernel, R Sundar, Przemek Kitszel

Add str_locked_unlocked()/str_unlocked_locked() helper to return
"locked" or "unlocked" string literal.

Suggested-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: R Sundar <prosunofficial@gmail.com>
---
 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 f3ba4f52ff26..a6bbf4e42c13 100644
--- a/include/linux/string_choices.h
+++ b/include/linux/string_choices.h
@@ -41,6 +41,12 @@ static inline const char *str_high_low(bool v)
 }
 #define str_low_high(v)		str_high_low(!(v))
 
+static inline const char *str_locked_unlocked(bool v)
+{
+	return v ? "locked" : "unlocked";
+}
+#define str_unlocked_locked(v)         str_locked_unlocked(!(v))
+
 static inline const char *str_on_off(bool v)
 {
 	return v ? "on" : "off";
-- 
2.34.1


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

* Re: [PATCH v2 linux-next 0/2] lib/string_choices: Sorting function order
  2024-11-19  2:17 [PATCH v2 linux-next 0/2] lib/string_choices: Sorting function order R Sundar
  2024-11-19  2:17 ` [PATCH v2 linux-next 1/2] lib/string_choices: Rearrange functions in sorted order R Sundar
  2024-11-19  2:17 ` [PATCH v2 linux-next 2/2] lib/string_choices: Add str_locked_unlocked()/str_unlocked_locked() helper R Sundar
@ 2024-11-19  8:35 ` Andy Shevchenko
  2025-01-13 15:49 ` Andy Shevchenko
  3 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2024-11-19  8:35 UTC (permalink / raw)
  To: R Sundar; +Cc: Kees Cook, Andy Shevchenko, linux-hardening, linux-kernel

On Tue, Nov 19, 2024 at 4:17 AM R Sundar <prosunofficial@gmail.com> wrote:
>
> This patch series rearrange misplaced functions in sorted order and add
> str_locked_unlocked() helper.

LGTM,
Reviewed-by: Andy Shevchenko <andy@kernel.org>

-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v2 linux-next 0/2] lib/string_choices: Sorting function order
  2024-11-19  2:17 [PATCH v2 linux-next 0/2] lib/string_choices: Sorting function order R Sundar
                   ` (2 preceding siblings ...)
  2024-11-19  8:35 ` [PATCH v2 linux-next 0/2] lib/string_choices: Sorting function order Andy Shevchenko
@ 2025-01-13 15:49 ` Andy Shevchenko
  3 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2025-01-13 15:49 UTC (permalink / raw)
  To: R Sundar; +Cc: Kees Cook, linux-hardening, linux-kernel

On Tue, Nov 19, 2024 at 07:47:17AM +0530, R Sundar wrote:
> This patch series rearrange misplaced functions in sorted order and add 
> str_locked_unlocked() helper.

Kees, anything preventing us to apply the first patch from the series?

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v2 linux-next 1/2] lib/string_choices: Rearrange functions in sorted order
  2024-11-19  2:17 ` [PATCH v2 linux-next 1/2] lib/string_choices: Rearrange functions in sorted order R Sundar
@ 2025-01-14 12:33   ` Larysa Zaremba
  2025-01-14 16:03     ` R Sundar
  2025-03-03 17:17   ` (subset) " Kees Cook
  1 sibling, 1 reply; 8+ messages in thread
From: Larysa Zaremba @ 2025-01-14 12:33 UTC (permalink / raw)
  To: R Sundar
  Cc: Kees Cook, Andy Shevchenko, linux-hardening, linux-kernel,
	Andy Shevchenko

On Tue, Nov 19, 2024 at 07:47:18AM +0530, R Sundar wrote:
> Rearrange misplaced functions in sorted order.
> 
> Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Signed-off-by: R Sundar <prosunofficial@gmail.com>

Reviewed-by: Larysa Zaremba <larysa.zaremba@intel.com>

This is a much-needed patch.

R Sundar,
Can I pick it into my series in case it will not be accepted in the nearest 
future? (I do not promise this, but there is a chance)

> ---
>  include/linux/string_choices.h | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h
> index 120ca0f28e95..f3ba4f52ff26 100644
> --- a/include/linux/string_choices.h
> +++ b/include/linux/string_choices.h
> @@ -41,23 +41,23 @@ static inline const char *str_high_low(bool v)
>  }
>  #define str_low_high(v)		str_high_low(!(v))
>  
> -static inline const char *str_read_write(bool v)
> -{
> -	return v ? "read" : "write";
> -}
> -#define str_write_read(v)		str_read_write(!(v))
> -
>  static inline const char *str_on_off(bool v)
>  {
>  	return v ? "on" : "off";
>  }
>  #define str_off_on(v)		str_on_off(!(v))
>  
> -static inline const char *str_yes_no(bool v)
> +static inline const char *str_read_write(bool v)
>  {
> -	return v ? "yes" : "no";
> +	return v ? "read" : "write";
>  }
> -#define str_no_yes(v)		str_yes_no(!(v))
> +#define str_write_read(v)		str_read_write(!(v))
> +
> +static inline const char *str_true_false(bool v)
> +{
> +	return v ? "true" : "false";
> +}
> +#define str_false_true(v)		str_true_false(!(v))
>  
>  static inline const char *str_up_down(bool v)
>  {
> @@ -65,11 +65,11 @@ 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)
> +static inline const char *str_yes_no(bool v)
>  {
> -	return v ? "true" : "false";
> +	return v ? "yes" : "no";
>  }
> -#define str_false_true(v)		str_true_false(!(v))
> +#define str_no_yes(v)		str_yes_no(!(v))
>  
>  /**
>   * str_plural - Return the simple pluralization based on English counts
> -- 
> 2.34.1
> 

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

* Re: [PATCH v2 linux-next 1/2] lib/string_choices: Rearrange functions in sorted order
  2025-01-14 12:33   ` Larysa Zaremba
@ 2025-01-14 16:03     ` R Sundar
  0 siblings, 0 replies; 8+ messages in thread
From: R Sundar @ 2025-01-14 16:03 UTC (permalink / raw)
  To: Larysa Zaremba
  Cc: Kees Cook, Andy Shevchenko, linux-hardening, linux-kernel,
	Andy Shevchenko

On 14/01/25 18:03, Larysa Zaremba wrote:
> On Tue, Nov 19, 2024 at 07:47:18AM +0530, R Sundar wrote:
>> Rearrange misplaced functions in sorted order.
>>
>> Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
>> Signed-off-by: R Sundar <prosunofficial@gmail.com>
> 
> Reviewed-by: Larysa Zaremba <larysa.zaremba@intel.com>
> 
> This is a much-needed patch.
> 
> R Sundar,
> Can I pick it into my series in case it will not be accepted in the nearest
> future? (I do not promise this, but there is a chance)
> 
Hi,

Yes, Please.

Thanks.

Best Regards,
Sundar

>> ---
>>   include/linux/string_choices.h | 24 ++++++++++++------------
>>   1 file changed, 12 insertions(+), 12 deletions(-)
>>
>> diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h
>> index 120ca0f28e95..f3ba4f52ff26 100644
>> --- a/include/linux/string_choices.h
>> +++ b/include/linux/string_choices.h
>> @@ -41,23 +41,23 @@ static inline const char *str_high_low(bool v)
>>   }
>>   #define str_low_high(v)		str_high_low(!(v))
>>   
>> -static inline const char *str_read_write(bool v)
>> -{
>> -	return v ? "read" : "write";
>> -}
>> -#define str_write_read(v)		str_read_write(!(v))
>> -
>>   static inline const char *str_on_off(bool v)
>>   {
>>   	return v ? "on" : "off";
>>   }
>>   #define str_off_on(v)		str_on_off(!(v))
>>   
>> -static inline const char *str_yes_no(bool v)
>> +static inline const char *str_read_write(bool v)
>>   {
>> -	return v ? "yes" : "no";
>> +	return v ? "read" : "write";
>>   }
>> -#define str_no_yes(v)		str_yes_no(!(v))
>> +#define str_write_read(v)		str_read_write(!(v))
>> +
>> +static inline const char *str_true_false(bool v)
>> +{
>> +	return v ? "true" : "false";
>> +}
>> +#define str_false_true(v)		str_true_false(!(v))
>>   
>>   static inline const char *str_up_down(bool v)
>>   {
>> @@ -65,11 +65,11 @@ 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)
>> +static inline const char *str_yes_no(bool v)
>>   {
>> -	return v ? "true" : "false";
>> +	return v ? "yes" : "no";
>>   }
>> -#define str_false_true(v)		str_true_false(!(v))
>> +#define str_no_yes(v)		str_yes_no(!(v))
>>   
>>   /**
>>    * str_plural - Return the simple pluralization based on English counts
>> -- 
>> 2.34.1
>>


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

* Re: (subset) [PATCH v2 linux-next 1/2] lib/string_choices: Rearrange functions in sorted order
  2024-11-19  2:17 ` [PATCH v2 linux-next 1/2] lib/string_choices: Rearrange functions in sorted order R Sundar
  2025-01-14 12:33   ` Larysa Zaremba
@ 2025-03-03 17:17   ` Kees Cook
  1 sibling, 0 replies; 8+ messages in thread
From: Kees Cook @ 2025-03-03 17:17 UTC (permalink / raw)
  To: Andy Shevchenko, R Sundar
  Cc: Kees Cook, linux-hardening, linux-kernel, Andy Shevchenko

On Tue, 19 Nov 2024 07:47:18 +0530, R Sundar wrote:
> Rearrange misplaced functions in sorted order.
> 
> 

Applied to for-next/hardening, thanks!

[1/2] lib/string_choices: Rearrange functions in sorted order
      https://git.kernel.org/kees/c/e8cd61e403ea

Take care,

-- 
Kees Cook


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

end of thread, other threads:[~2025-03-03 17:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-19  2:17 [PATCH v2 linux-next 0/2] lib/string_choices: Sorting function order R Sundar
2024-11-19  2:17 ` [PATCH v2 linux-next 1/2] lib/string_choices: Rearrange functions in sorted order R Sundar
2025-01-14 12:33   ` Larysa Zaremba
2025-01-14 16:03     ` R Sundar
2025-03-03 17:17   ` (subset) " Kees Cook
2024-11-19  2:17 ` [PATCH v2 linux-next 2/2] lib/string_choices: Add str_locked_unlocked()/str_unlocked_locked() helper R Sundar
2024-11-19  8:35 ` [PATCH v2 linux-next 0/2] lib/string_choices: Sorting function order Andy Shevchenko
2025-01-13 15: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