All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM:mach-msm: seting tail NUL after strncpy
@ 2013-01-30  5:01 ` Chen Gang
  0 siblings, 0 replies; 14+ messages in thread
From: Chen Gang @ 2013-01-30  5:01 UTC (permalink / raw)
  To: davidb, dwalker, bryanh, Russell King - ARM Linux
  Cc: linux-arm-kernel, linux-arm-msm


  temp need NUL terminated, or next ptr may cause issue.

Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
 arch/arm/mach-msm/clock-debug.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-msm/clock-debug.c
b/arch/arm/mach-msm/clock-debug.c
index 4886404..bdca900 100644
--- a/arch/arm/mach-msm/clock-debug.c
+++ b/arch/arm/mach-msm/clock-debug.c
@@ -105,6 +105,8 @@ int __init clock_debug_add(struct clk *clock)
 		return -ENOMEM;

 	strncpy(temp, clock->dbg_name, ARRAY_SIZE(temp)-1);
+	temp[ARRAY_SIZE(temp)-1] = '\0';
+
 	for (ptr = temp; *ptr; ptr++)
 		*ptr = tolower(*ptr);

-- 
1.7.10.4

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

* [PATCH] ARM:mach-msm: seting tail NUL after strncpy
@ 2013-01-30  5:01 ` Chen Gang
  0 siblings, 0 replies; 14+ messages in thread
From: Chen Gang @ 2013-01-30  5:01 UTC (permalink / raw)
  To: linux-arm-kernel


  temp need NUL terminated, or next ptr may cause issue.

Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
 arch/arm/mach-msm/clock-debug.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-msm/clock-debug.c
b/arch/arm/mach-msm/clock-debug.c
index 4886404..bdca900 100644
--- a/arch/arm/mach-msm/clock-debug.c
+++ b/arch/arm/mach-msm/clock-debug.c
@@ -105,6 +105,8 @@ int __init clock_debug_add(struct clk *clock)
 		return -ENOMEM;

 	strncpy(temp, clock->dbg_name, ARRAY_SIZE(temp)-1);
+	temp[ARRAY_SIZE(temp)-1] = '\0';
+
 	for (ptr = temp; *ptr; ptr++)
 		*ptr = tolower(*ptr);

-- 
1.7.10.4

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

* Re: [PATCH] ARM:mach-msm: seting tail NUL after strncpy
  2013-01-30  5:01 ` Chen Gang
@ 2013-01-30  9:19   ` Bjørn Mork
  -1 siblings, 0 replies; 14+ messages in thread
From: Bjørn Mork @ 2013-01-30  9:19 UTC (permalink / raw)
  To: Chen Gang
  Cc: davidb, dwalker, bryanh, Russell King - ARM Linux,
	linux-arm-kernel, linux-arm-msm

Chen Gang <gang.chen@asianux.com> writes:

>   temp need NUL terminated, or next ptr may cause issue.
>
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
>  arch/arm/mach-msm/clock-debug.c |    2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/arm/mach-msm/clock-debug.c
> b/arch/arm/mach-msm/clock-debug.c
> index 4886404..bdca900 100644
> --- a/arch/arm/mach-msm/clock-debug.c
> +++ b/arch/arm/mach-msm/clock-debug.c
> @@ -105,6 +105,8 @@ int __init clock_debug_add(struct clk *clock)
>  		return -ENOMEM;
>
>  	strncpy(temp, clock->dbg_name, ARRAY_SIZE(temp)-1);
> +	temp[ARRAY_SIZE(temp)-1] = '\0';
> +
>  	for (ptr = temp; *ptr; ptr++)
>  		*ptr = tolower(*ptr);

Maybe use strlcpy() instead?


Bjørn

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

* [PATCH] ARM:mach-msm: seting tail NUL after strncpy
@ 2013-01-30  9:19   ` Bjørn Mork
  0 siblings, 0 replies; 14+ messages in thread
From: Bjørn Mork @ 2013-01-30  9:19 UTC (permalink / raw)
  To: linux-arm-kernel

Chen Gang <gang.chen@asianux.com> writes:

>   temp need NUL terminated, or next ptr may cause issue.
>
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
>  arch/arm/mach-msm/clock-debug.c |    2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/arm/mach-msm/clock-debug.c
> b/arch/arm/mach-msm/clock-debug.c
> index 4886404..bdca900 100644
> --- a/arch/arm/mach-msm/clock-debug.c
> +++ b/arch/arm/mach-msm/clock-debug.c
> @@ -105,6 +105,8 @@ int __init clock_debug_add(struct clk *clock)
>  		return -ENOMEM;
>
>  	strncpy(temp, clock->dbg_name, ARRAY_SIZE(temp)-1);
> +	temp[ARRAY_SIZE(temp)-1] = '\0';
> +
>  	for (ptr = temp; *ptr; ptr++)
>  		*ptr = tolower(*ptr);

Maybe use strlcpy() instead?


Bj?rn

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

* Re: [PATCH] ARM:mach-msm: seting tail NUL after strncpy
  2013-01-30  9:19   ` Bjørn Mork
@ 2013-01-30 10:46     ` Chen Gang
  -1 siblings, 0 replies; 14+ messages in thread
From: Chen Gang @ 2013-01-30 10:46 UTC (permalink / raw)
  To: Bjørn Mork
  Cc: davidb, dwalker, bryanh, Russell King - ARM Linux,
	linux-arm-kernel, linux-arm-msm

于 2013年01月30日 17:19, Bjørn Mork 写道:
> Maybe use strlcpy() instead?

  ok, I will send patch v2.

  it will be "strlcpy(temp, clock->dbg_name, ARRAY_SIZE(temp));"


  thanks.

-- 
Chen Gang

Asianux Corporation

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

* [PATCH] ARM:mach-msm: seting tail NUL after strncpy
@ 2013-01-30 10:46     ` Chen Gang
  0 siblings, 0 replies; 14+ messages in thread
From: Chen Gang @ 2013-01-30 10:46 UTC (permalink / raw)
  To: linux-arm-kernel

? 2013?01?30? 17:19, Bj?rn Mork ??:
> Maybe use strlcpy() instead?

  ok, I will send patch v2.

  it will be "strlcpy(temp, clock->dbg_name, ARRAY_SIZE(temp));"


  thanks.

-- 
Chen Gang

Asianux Corporation

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

* [PATCH v2] ARM:mach-msm: using strlcpy instead lof strncpy
  2013-01-30  9:19   ` Bjørn Mork
@ 2013-01-30 11:12     ` Chen Gang
  -1 siblings, 0 replies; 14+ messages in thread
From: Chen Gang @ 2013-01-30 11:12 UTC (permalink / raw)
  To: Bjørn Mork
  Cc: davidb, dwalker, bryanh, Russell King - ARM Linux,
	linux-arm-kernel, linux-arm-msm


  The fields must be null-terminated, or next ptr, will cause issue

Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
 arch/arm/mach-msm/clock-debug.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-msm/clock-debug.c b/arch/arm/mach-msm/clock-debug.c
index 4886404..c40dcaf 100644
--- a/arch/arm/mach-msm/clock-debug.c
+++ b/arch/arm/mach-msm/clock-debug.c
@@ -17,6 +17,7 @@
 #include <linux/module.h>
 #include <linux/ctype.h>
 #include <linux/debugfs.h>
+#include <linux/string.h>
 #include <linux/clk.h>
 #include "clock.h"
 
@@ -104,7 +105,7 @@ int __init clock_debug_add(struct clk *clock)
 	if (!debugfs_base)
 		return -ENOMEM;
 
-	strncpy(temp, clock->dbg_name, ARRAY_SIZE(temp)-1);
+	strlcpy(temp, clock->dbg_name, ARRAY_SIZE(temp));
 	for (ptr = temp; *ptr; ptr++)
 		*ptr = tolower(*ptr);
 
-- 
1.7.10.4

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

* [PATCH v2] ARM:mach-msm: using strlcpy instead lof strncpy
@ 2013-01-30 11:12     ` Chen Gang
  0 siblings, 0 replies; 14+ messages in thread
From: Chen Gang @ 2013-01-30 11:12 UTC (permalink / raw)
  To: linux-arm-kernel


  The fields must be null-terminated, or next ptr, will cause issue

Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
 arch/arm/mach-msm/clock-debug.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-msm/clock-debug.c b/arch/arm/mach-msm/clock-debug.c
index 4886404..c40dcaf 100644
--- a/arch/arm/mach-msm/clock-debug.c
+++ b/arch/arm/mach-msm/clock-debug.c
@@ -17,6 +17,7 @@
 #include <linux/module.h>
 #include <linux/ctype.h>
 #include <linux/debugfs.h>
+#include <linux/string.h>
 #include <linux/clk.h>
 #include "clock.h"
 
@@ -104,7 +105,7 @@ int __init clock_debug_add(struct clk *clock)
 	if (!debugfs_base)
 		return -ENOMEM;
 
-	strncpy(temp, clock->dbg_name, ARRAY_SIZE(temp)-1);
+	strlcpy(temp, clock->dbg_name, ARRAY_SIZE(temp));
 	for (ptr = temp; *ptr; ptr++)
 		*ptr = tolower(*ptr);
 
-- 
1.7.10.4

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

* Re: [PATCH] ARM:mach-msm: seting tail NUL after strncpy
  2013-01-30  5:01 ` Chen Gang
@ 2013-01-30 21:33   ` David Brown
  -1 siblings, 0 replies; 14+ messages in thread
From: David Brown @ 2013-01-30 21:33 UTC (permalink / raw)
  To: Chen Gang, Stephen Boyd
  Cc: dwalker, bryanh, Russell King - ARM Linux, linux-arm-kernel,
	linux-arm-msm

Chen Gang <gang.chen@asianux.com> writes:

>   temp need NUL terminated, or next ptr may cause issue.
>
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
>  arch/arm/mach-msm/clock-debug.c |    2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/arm/mach-msm/clock-debug.c
> b/arch/arm/mach-msm/clock-debug.c
> index 4886404..bdca900 100644
> --- a/arch/arm/mach-msm/clock-debug.c
> +++ b/arch/arm/mach-msm/clock-debug.c
> @@ -105,6 +105,8 @@ int __init clock_debug_add(struct clk *clock)
>  		return -ENOMEM;
>
>  	strncpy(temp, clock->dbg_name, ARRAY_SIZE(temp)-1);
> +	temp[ARRAY_SIZE(temp)-1] = '\0';
> +
>  	for (ptr = temp; *ptr; ptr++)

I believe that Stephen Boyd is putting some significant work into this
code.  Stephen, can you see if this bug is still in your current
version of the code, and make sure that it is fixed there?

Thanks,
David

-- 
sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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

* [PATCH] ARM:mach-msm: seting tail NUL after strncpy
@ 2013-01-30 21:33   ` David Brown
  0 siblings, 0 replies; 14+ messages in thread
From: David Brown @ 2013-01-30 21:33 UTC (permalink / raw)
  To: linux-arm-kernel

Chen Gang <gang.chen@asianux.com> writes:

>   temp need NUL terminated, or next ptr may cause issue.
>
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
>  arch/arm/mach-msm/clock-debug.c |    2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/arm/mach-msm/clock-debug.c
> b/arch/arm/mach-msm/clock-debug.c
> index 4886404..bdca900 100644
> --- a/arch/arm/mach-msm/clock-debug.c
> +++ b/arch/arm/mach-msm/clock-debug.c
> @@ -105,6 +105,8 @@ int __init clock_debug_add(struct clk *clock)
>  		return -ENOMEM;
>
>  	strncpy(temp, clock->dbg_name, ARRAY_SIZE(temp)-1);
> +	temp[ARRAY_SIZE(temp)-1] = '\0';
> +
>  	for (ptr = temp; *ptr; ptr++)

I believe that Stephen Boyd is putting some significant work into this
code.  Stephen, can you see if this bug is still in your current
version of the code, and make sure that it is fixed there?

Thanks,
David

-- 
sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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

* Re: [PATCH] ARM:mach-msm: seting tail NUL after strncpy
  2013-01-30 21:33   ` David Brown
@ 2013-01-30 21:59     ` Stephen Boyd
  -1 siblings, 0 replies; 14+ messages in thread
From: Stephen Boyd @ 2013-01-30 21:59 UTC (permalink / raw)
  To: David Brown
  Cc: Chen Gang, dwalker, bryanh, Russell King - ARM Linux,
	linux-arm-kernel, linux-arm-msm

On 01/30/13 13:33, David Brown wrote:
> Chen Gang <gang.chen@asianux.com> writes:
>
>>   temp need NUL terminated, or next ptr may cause issue.
>>
>> Signed-off-by: Chen Gang <gang.chen@asianux.com>
>> ---
>>  arch/arm/mach-msm/clock-debug.c |    2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/arch/arm/mach-msm/clock-debug.c
>> b/arch/arm/mach-msm/clock-debug.c
>> index 4886404..bdca900 100644
>> --- a/arch/arm/mach-msm/clock-debug.c
>> +++ b/arch/arm/mach-msm/clock-debug.c
>> @@ -105,6 +105,8 @@ int __init clock_debug_add(struct clk *clock)
>>  		return -ENOMEM;
>>
>>  	strncpy(temp, clock->dbg_name, ARRAY_SIZE(temp)-1);
>> +	temp[ARRAY_SIZE(temp)-1] = '\0';
>> +
>>  	for (ptr = temp; *ptr; ptr++)
> I believe that Stephen Boyd is putting some significant work into this
> code.  Stephen, can you see if this bug is still in your current
> version of the code, and make sure that it is fixed there?
>

This entire file is deleted in my set of patches that moves the current
MSM clock code to the common clock framework.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

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

* [PATCH] ARM:mach-msm: seting tail NUL after strncpy
@ 2013-01-30 21:59     ` Stephen Boyd
  0 siblings, 0 replies; 14+ messages in thread
From: Stephen Boyd @ 2013-01-30 21:59 UTC (permalink / raw)
  To: linux-arm-kernel

On 01/30/13 13:33, David Brown wrote:
> Chen Gang <gang.chen@asianux.com> writes:
>
>>   temp need NUL terminated, or next ptr may cause issue.
>>
>> Signed-off-by: Chen Gang <gang.chen@asianux.com>
>> ---
>>  arch/arm/mach-msm/clock-debug.c |    2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/arch/arm/mach-msm/clock-debug.c
>> b/arch/arm/mach-msm/clock-debug.c
>> index 4886404..bdca900 100644
>> --- a/arch/arm/mach-msm/clock-debug.c
>> +++ b/arch/arm/mach-msm/clock-debug.c
>> @@ -105,6 +105,8 @@ int __init clock_debug_add(struct clk *clock)
>>  		return -ENOMEM;
>>
>>  	strncpy(temp, clock->dbg_name, ARRAY_SIZE(temp)-1);
>> +	temp[ARRAY_SIZE(temp)-1] = '\0';
>> +
>>  	for (ptr = temp; *ptr; ptr++)
> I believe that Stephen Boyd is putting some significant work into this
> code.  Stephen, can you see if this bug is still in your current
> version of the code, and make sure that it is fixed there?
>

This entire file is deleted in my set of patches that moves the current
MSM clock code to the common clock framework.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

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

* Re: [PATCH] ARM:mach-msm: seting tail NUL after strncpy
  2013-01-30 21:59     ` Stephen Boyd
@ 2013-02-01  1:12       ` Chen Gang
  -1 siblings, 0 replies; 14+ messages in thread
From: Chen Gang @ 2013-02-01  1:12 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: David Brown, dwalker, bryanh, Russell King - ARM Linux,
	linux-arm-kernel, linux-arm-msm

于 2013年01月31日 05:59, Stephen Boyd 写道:
> On 01/30/13 13:33, David Brown wrote:
>> I believe that Stephen Boyd is putting some significant work into this
>> code.  Stephen, can you see if this bug is still in your current
>> version of the code, and make sure that it is fixed there?
>>
> 
> This entire file is deleted in my set of patches that moves the current
> MSM clock code to the common clock framework.
> 

  ok, thank you.

  :-)

-- 
Chen Gang

Asianux Corporation

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

* [PATCH] ARM:mach-msm: seting tail NUL after strncpy
@ 2013-02-01  1:12       ` Chen Gang
  0 siblings, 0 replies; 14+ messages in thread
From: Chen Gang @ 2013-02-01  1:12 UTC (permalink / raw)
  To: linux-arm-kernel

? 2013?01?31? 05:59, Stephen Boyd ??:
> On 01/30/13 13:33, David Brown wrote:
>> I believe that Stephen Boyd is putting some significant work into this
>> code.  Stephen, can you see if this bug is still in your current
>> version of the code, and make sure that it is fixed there?
>>
> 
> This entire file is deleted in my set of patches that moves the current
> MSM clock code to the common clock framework.
> 

  ok, thank you.

  :-)

-- 
Chen Gang

Asianux Corporation

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

end of thread, other threads:[~2013-02-01  1:12 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-30  5:01 [PATCH] ARM:mach-msm: seting tail NUL after strncpy Chen Gang
2013-01-30  5:01 ` Chen Gang
2013-01-30  9:19 ` Bjørn Mork
2013-01-30  9:19   ` Bjørn Mork
2013-01-30 10:46   ` Chen Gang
2013-01-30 10:46     ` Chen Gang
2013-01-30 11:12   ` [PATCH v2] ARM:mach-msm: using strlcpy instead lof strncpy Chen Gang
2013-01-30 11:12     ` Chen Gang
2013-01-30 21:33 ` [PATCH] ARM:mach-msm: seting tail NUL after strncpy David Brown
2013-01-30 21:33   ` David Brown
2013-01-30 21:59   ` Stephen Boyd
2013-01-30 21:59     ` Stephen Boyd
2013-02-01  1:12     ` Chen Gang
2013-02-01  1:12       ` Chen Gang

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.