All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] init/main: Use strtobool for param parsing in set_debug_rodata()
@ 2022-10-24  9:38 ` Tong Tiangen
  0 siblings, 0 replies; 6+ messages in thread
From: Tong Tiangen @ 2022-10-24  9:38 UTC (permalink / raw)
  To: Mark Rutland, linux-kernel, will, ardb, linux-arm-kernel
  Cc: Tong Tiangen, wangkefeng.wang, Guohanjun

Aftern parsing "full", we can still use strtobool rather than "on" and
"off" parsing in set_debug_rodata().

Fixes: 2e8cff0a0eee ("arm64: fix rodata=full")
Signed-off-by: Tong Tiangen <tongtiangen@huawei.com>
---
 init/main.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/init/main.c b/init/main.c
index aa21add5f7c5..f420e20b1fa3 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1463,13 +1463,7 @@ static int __init set_debug_rodata(char *str)
 	if (arch_parse_debug_rodata(str))
 		return 0;
 
-	if (str && !strcmp(str, "on"))
-		rodata_enabled = true;
-	else if (str && !strcmp(str, "off"))
-		rodata_enabled = false;
-	else
-		pr_warn("Invalid option string for rodata: '%s'\n", str);
-	return 0;
+	return strtobool(str, &rodata_enabled);
 }
 early_param("rodata", set_debug_rodata);
 #endif
-- 
2.25.1


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

* [PATCH -next] init/main: Use strtobool for param parsing in set_debug_rodata()
@ 2022-10-24  9:38 ` Tong Tiangen
  0 siblings, 0 replies; 6+ messages in thread
From: Tong Tiangen @ 2022-10-24  9:38 UTC (permalink / raw)
  To: Mark Rutland, linux-kernel, will, ardb, linux-arm-kernel
  Cc: Tong Tiangen, wangkefeng.wang, Guohanjun

Aftern parsing "full", we can still use strtobool rather than "on" and
"off" parsing in set_debug_rodata().

Fixes: 2e8cff0a0eee ("arm64: fix rodata=full")
Signed-off-by: Tong Tiangen <tongtiangen@huawei.com>
---
 init/main.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/init/main.c b/init/main.c
index aa21add5f7c5..f420e20b1fa3 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1463,13 +1463,7 @@ static int __init set_debug_rodata(char *str)
 	if (arch_parse_debug_rodata(str))
 		return 0;
 
-	if (str && !strcmp(str, "on"))
-		rodata_enabled = true;
-	else if (str && !strcmp(str, "off"))
-		rodata_enabled = false;
-	else
-		pr_warn("Invalid option string for rodata: '%s'\n", str);
-	return 0;
+	return strtobool(str, &rodata_enabled);
 }
 early_param("rodata", set_debug_rodata);
 #endif
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH -next] init/main: Use strtobool for param parsing in set_debug_rodata()
  2022-10-24  9:38 ` Tong Tiangen
@ 2022-10-24 11:00   ` Mark Rutland
  -1 siblings, 0 replies; 6+ messages in thread
From: Mark Rutland @ 2022-10-24 11:00 UTC (permalink / raw)
  To: Tong Tiangen
  Cc: linux-kernel, will, ardb, linux-arm-kernel, wangkefeng.wang, Guohanjun

On Mon, Oct 24, 2022 at 09:38:17AM +0000, Tong Tiangen wrote:
> Aftern parsing "full", we can still use strtobool rather than "on" and
> "off" parsing in set_debug_rodata().
> 
> Fixes: 2e8cff0a0eee ("arm64: fix rodata=full")

Why do you think this is a fix; what do you believe is broken?

As noted in the commit message for 2e8cff0a0eee, we *deliberately* don't use
strtobool() here so that we don't accept garbage values like "ful".

NAK to this patch as it stands.

Thanks,
Mark.

> Signed-off-by: Tong Tiangen <tongtiangen@huawei.com>
> ---
>  init/main.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/init/main.c b/init/main.c
> index aa21add5f7c5..f420e20b1fa3 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -1463,13 +1463,7 @@ static int __init set_debug_rodata(char *str)
>  	if (arch_parse_debug_rodata(str))
>  		return 0;
>  
> -	if (str && !strcmp(str, "on"))
> -		rodata_enabled = true;
> -	else if (str && !strcmp(str, "off"))
> -		rodata_enabled = false;
> -	else
> -		pr_warn("Invalid option string for rodata: '%s'\n", str);
> -	return 0;
> +	return strtobool(str, &rodata_enabled);
>  }
>  early_param("rodata", set_debug_rodata);
>  #endif
> -- 
> 2.25.1
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH -next] init/main: Use strtobool for param parsing in set_debug_rodata()
@ 2022-10-24 11:00   ` Mark Rutland
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Rutland @ 2022-10-24 11:00 UTC (permalink / raw)
  To: Tong Tiangen
  Cc: linux-kernel, will, ardb, linux-arm-kernel, wangkefeng.wang, Guohanjun

On Mon, Oct 24, 2022 at 09:38:17AM +0000, Tong Tiangen wrote:
> Aftern parsing "full", we can still use strtobool rather than "on" and
> "off" parsing in set_debug_rodata().
> 
> Fixes: 2e8cff0a0eee ("arm64: fix rodata=full")

Why do you think this is a fix; what do you believe is broken?

As noted in the commit message for 2e8cff0a0eee, we *deliberately* don't use
strtobool() here so that we don't accept garbage values like "ful".

NAK to this patch as it stands.

Thanks,
Mark.

> Signed-off-by: Tong Tiangen <tongtiangen@huawei.com>
> ---
>  init/main.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/init/main.c b/init/main.c
> index aa21add5f7c5..f420e20b1fa3 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -1463,13 +1463,7 @@ static int __init set_debug_rodata(char *str)
>  	if (arch_parse_debug_rodata(str))
>  		return 0;
>  
> -	if (str && !strcmp(str, "on"))
> -		rodata_enabled = true;
> -	else if (str && !strcmp(str, "off"))
> -		rodata_enabled = false;
> -	else
> -		pr_warn("Invalid option string for rodata: '%s'\n", str);
> -	return 0;
> +	return strtobool(str, &rodata_enabled);
>  }
>  early_param("rodata", set_debug_rodata);
>  #endif
> -- 
> 2.25.1
> 

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

* Re: [PATCH -next] init/main: Use strtobool for param parsing in set_debug_rodata()
  2022-10-24 11:00   ` Mark Rutland
@ 2022-10-24 11:27     ` Tong Tiangen
  -1 siblings, 0 replies; 6+ messages in thread
From: Tong Tiangen @ 2022-10-24 11:27 UTC (permalink / raw)
  To: Mark Rutland
  Cc: linux-kernel, will, ardb, linux-arm-kernel, wangkefeng.wang, Guohanjun



在 2022/10/24 19:00, Mark Rutland 写道:
> On Mon, Oct 24, 2022 at 09:38:17AM +0000, Tong Tiangen wrote:
>> Aftern parsing "full", we can still use strtobool rather than "on" and
>> "off" parsing in set_debug_rodata().
>>
>> Fixes: 2e8cff0a0eee ("arm64: fix rodata=full")
> 
> Why do you think this is a fix; what do you believe is broken?
> 
> As noted in the commit message for 2e8cff0a0eee, we *deliberately* don't use
> strtobool() here so that we don't accept garbage values like "ful".
> 
> NAK to this patch as it stands.
> 
> Thanks,
> Mark.

Hi Mark:

Ok, missing that.

Thanks,
Tong.

> 
>> Signed-off-by: Tong Tiangen <tongtiangen@huawei.com>
>> ---
>>   init/main.c | 8 +-------
>>   1 file changed, 1 insertion(+), 7 deletions(-)
>>
>> diff --git a/init/main.c b/init/main.c
>> index aa21add5f7c5..f420e20b1fa3 100644
>> --- a/init/main.c
>> +++ b/init/main.c
>> @@ -1463,13 +1463,7 @@ static int __init set_debug_rodata(char *str)
>>   	if (arch_parse_debug_rodata(str))
>>   		return 0;
>>   
>> -	if (str && !strcmp(str, "on"))
>> -		rodata_enabled = true;
>> -	else if (str && !strcmp(str, "off"))
>> -		rodata_enabled = false;
>> -	else
>> -		pr_warn("Invalid option string for rodata: '%s'\n", str);
>> -	return 0;
>> +	return strtobool(str, &rodata_enabled);
>>   }
>>   early_param("rodata", set_debug_rodata);
>>   #endif
>> -- 
>> 2.25.1
>>
> 
> .

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

* Re: [PATCH -next] init/main: Use strtobool for param parsing in set_debug_rodata()
@ 2022-10-24 11:27     ` Tong Tiangen
  0 siblings, 0 replies; 6+ messages in thread
From: Tong Tiangen @ 2022-10-24 11:27 UTC (permalink / raw)
  To: Mark Rutland
  Cc: linux-kernel, will, ardb, linux-arm-kernel, wangkefeng.wang, Guohanjun



在 2022/10/24 19:00, Mark Rutland 写道:
> On Mon, Oct 24, 2022 at 09:38:17AM +0000, Tong Tiangen wrote:
>> Aftern parsing "full", we can still use strtobool rather than "on" and
>> "off" parsing in set_debug_rodata().
>>
>> Fixes: 2e8cff0a0eee ("arm64: fix rodata=full")
> 
> Why do you think this is a fix; what do you believe is broken?
> 
> As noted in the commit message for 2e8cff0a0eee, we *deliberately* don't use
> strtobool() here so that we don't accept garbage values like "ful".
> 
> NAK to this patch as it stands.
> 
> Thanks,
> Mark.

Hi Mark:

Ok, missing that.

Thanks,
Tong.

> 
>> Signed-off-by: Tong Tiangen <tongtiangen@huawei.com>
>> ---
>>   init/main.c | 8 +-------
>>   1 file changed, 1 insertion(+), 7 deletions(-)
>>
>> diff --git a/init/main.c b/init/main.c
>> index aa21add5f7c5..f420e20b1fa3 100644
>> --- a/init/main.c
>> +++ b/init/main.c
>> @@ -1463,13 +1463,7 @@ static int __init set_debug_rodata(char *str)
>>   	if (arch_parse_debug_rodata(str))
>>   		return 0;
>>   
>> -	if (str && !strcmp(str, "on"))
>> -		rodata_enabled = true;
>> -	else if (str && !strcmp(str, "off"))
>> -		rodata_enabled = false;
>> -	else
>> -		pr_warn("Invalid option string for rodata: '%s'\n", str);
>> -	return 0;
>> +	return strtobool(str, &rodata_enabled);
>>   }
>>   early_param("rodata", set_debug_rodata);
>>   #endif
>> -- 
>> 2.25.1
>>
> 
> .

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2022-10-24 11:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-24  9:38 [PATCH -next] init/main: Use strtobool for param parsing in set_debug_rodata() Tong Tiangen
2022-10-24  9:38 ` Tong Tiangen
2022-10-24 11:00 ` Mark Rutland
2022-10-24 11:00   ` Mark Rutland
2022-10-24 11:27   ` Tong Tiangen
2022-10-24 11:27     ` Tong Tiangen

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.