diff mbox

ARM:omap2: using strlcpy instead of strncpy

Message ID 51090829.1010109@asianux.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chen Gang Jan. 30, 2013, 11:46 a.m. UTC
the fields must be null-terminated:
  the caller may use it as null-terminted string, next.

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

Comments

Tony Lindgren Feb. 1, 2013, 10:45 p.m. UTC | #1
* Chen Gang <gang.chen@asianux.com> [130130 03:50]:
> 
>   the fields must be null-terminated:
>   the caller may use it as null-terminted string, next.

Added Peter to cc on this one too, it's best that he queues
all the twl changes.

Tony
 
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
>  arch/arm/mach-omap2/twl-common.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
> index e49b40b..6a7aec6 100644
> --- a/arch/arm/mach-omap2/twl-common.c
> +++ b/arch/arm/mach-omap2/twl-common.c
> @@ -23,6 +23,7 @@
>  #include <linux/i2c.h>
>  #include <linux/i2c/twl.h>
>  #include <linux/gpio.h>
> +#include <linux/string.h>
>  #include <linux/regulator/machine.h>
>  #include <linux/regulator/fixed.h>
>  
> @@ -56,7 +57,7 @@ void __init omap_pmic_init(int bus, u32 clkrate,
>  			   struct twl4030_platform_data *pmic_data)
>  {
>  	omap_mux_init_signal("sys_nirq", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
> -	strncpy(pmic_i2c_board_info.type, pmic_type,
> +	strlcpy(pmic_i2c_board_info.type, pmic_type,
>  		sizeof(pmic_i2c_board_info.type));
>  	pmic_i2c_board_info.irq = pmic_irq;
>  	pmic_i2c_board_info.platform_data = pmic_data;
> -- 
> 1.7.10.4
Chen Gang Feb. 2, 2013, 2:25 a.m. UTC | #2
? 2013?02?02? 06:45, Tony Lindgren ??:
> Added Peter to cc on this one too, it's best that he queues
> all the twl changes.

  is it suitable to sync the MAINTAINER file for it ?
    if suitable, can you help to change it ?

  thanks.
Tony Lindgren Feb. 2, 2013, 6:07 p.m. UTC | #3
* Chen Gang <gang.chen@asianux.com> [130201 18:29]:
> ? 2013?02?02? 06:45, Tony Lindgren ??:
> > Added Peter to cc on this one too, it's best that he queues
> > all the twl changes.
> 
>   is it suitable to sync the MAINTAINER file for it ?
>     if suitable, can you help to change it ?

Yes I suggest we add Peter as the maintainer for all twl
related things.

Regards,

Tony
Chen Gang Feb. 4, 2013, 1:17 a.m. UTC | #4
? 2013?02?03? 02:07, Tony Lindgren ??:
>>   is it suitable to sync the MAINTAINER file for it ?
>> >     if suitable, can you help to change it ?
> Yes I suggest we add Peter as the maintainer for all twl
> related things.
> 
> Regards,
> 
> Tony
> 
> 

  ok, thanks.

by the way:
  if necessary (not find another suitable members to sync it), I should
sync it (since I found it)
Peter Ujfalusi Feb. 4, 2013, 8:54 a.m. UTC | #5
On 01/30/2013 12:46 PM, Chen Gang wrote:
> 
>   the fields must be null-terminated:
>   the caller may use it as null-terminted string, next.
> 
> Signed-off-by: Chen Gang <gang.chen@asianux.com>

Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

> ---
>  arch/arm/mach-omap2/twl-common.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
> index e49b40b..6a7aec6 100644
> --- a/arch/arm/mach-omap2/twl-common.c
> +++ b/arch/arm/mach-omap2/twl-common.c
> @@ -23,6 +23,7 @@
>  #include <linux/i2c.h>
>  #include <linux/i2c/twl.h>
>  #include <linux/gpio.h>
> +#include <linux/string.h>
>  #include <linux/regulator/machine.h>
>  #include <linux/regulator/fixed.h>
>  
> @@ -56,7 +57,7 @@ void __init omap_pmic_init(int bus, u32 clkrate,
>  			   struct twl4030_platform_data *pmic_data)
>  {
>  	omap_mux_init_signal("sys_nirq", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
> -	strncpy(pmic_i2c_board_info.type, pmic_type,
> +	strlcpy(pmic_i2c_board_info.type, pmic_type,
>  		sizeof(pmic_i2c_board_info.type));
>  	pmic_i2c_board_info.irq = pmic_irq;
>  	pmic_i2c_board_info.platform_data = pmic_data;
>
Peter Ujfalusi Feb. 4, 2013, 9 a.m. UTC | #6
Hi Tony,

On 02/01/2013 11:45 PM, Tony Lindgren wrote:
> * Chen Gang <gang.chen@asianux.com> [130130 03:50]:
>>
>>   the fields must be null-terminated:
>>   the caller may use it as null-terminted string, next.
> 
> Added Peter to cc on this one too, it's best that he queues
> all the twl changes.

I can create a branch for you in our gitorious tree
(git://gitorious.org/omap-audio/linux-audio.git) for this patch. But I think
for now it would be best if you could take this via linux-omap (the file is
under arch/arm/mach-omap2 anyways)

Regards,
Péter

> 
> Tony
>  
>> Signed-off-by: Chen Gang <gang.chen@asianux.com>
>> ---
>>  arch/arm/mach-omap2/twl-common.c |    3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
>> index e49b40b..6a7aec6 100644
>> --- a/arch/arm/mach-omap2/twl-common.c
>> +++ b/arch/arm/mach-omap2/twl-common.c
>> @@ -23,6 +23,7 @@
>>  #include <linux/i2c.h>
>>  #include <linux/i2c/twl.h>
>>  #include <linux/gpio.h>
>> +#include <linux/string.h>
>>  #include <linux/regulator/machine.h>
>>  #include <linux/regulator/fixed.h>
>>  
>> @@ -56,7 +57,7 @@ void __init omap_pmic_init(int bus, u32 clkrate,
>>  			   struct twl4030_platform_data *pmic_data)
>>  {
>>  	omap_mux_init_signal("sys_nirq", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
>> -	strncpy(pmic_i2c_board_info.type, pmic_type,
>> +	strlcpy(pmic_i2c_board_info.type, pmic_type,
>>  		sizeof(pmic_i2c_board_info.type));
>>  	pmic_i2c_board_info.irq = pmic_irq;
>>  	pmic_i2c_board_info.platform_data = pmic_data;
>> -- 
>> 1.7.10.4
Tony Lindgren Feb. 4, 2013, 6:18 p.m. UTC | #7
* Peter Ujfalusi <peter.ujfalusi@ti.com> [130204 01:04]:
> Hi Tony,
> 
> On 02/01/2013 11:45 PM, Tony Lindgren wrote:
> > * Chen Gang <gang.chen@asianux.com> [130130 03:50]:
> >>
> >>   the fields must be null-terminated:
> >>   the caller may use it as null-terminted string, next.
> > 
> > Added Peter to cc on this one too, it's best that he queues
> > all the twl changes.
> 
> I can create a branch for you in our gitorious tree
> (git://gitorious.org/omap-audio/linux-audio.git) for this patch. But I think
> for now it would be best if you could take this via linux-omap (the file is
> under arch/arm/mach-omap2 anyways)

OK thanks I'll apply with your ack to omap-for-v3.9/fixes-noncritical.

Tony
Chen Gang Feb. 5, 2013, 2:18 a.m. UTC | #8
? 2013?02?05? 02:18, Tony Lindgren ??:
> * Peter Ujfalusi <peter.ujfalusi@ti.com> [130204 01:04]:
>> > Hi Tony,
>> > 
>> > I can create a branch for you in our gitorious tree
>> > (git://gitorious.org/omap-audio/linux-audio.git) for this patch. But I think
>> > for now it would be best if you could take this via linux-omap (the file is
>> > under arch/arm/mach-omap2 anyways)
> OK thanks I'll apply with your ack to omap-for-v3.9/fixes-noncritical.
> 
> Tony
> 

  Does it mean: we need not sync MAINTAINERS file for twl-*, recently ?

  :-)

  thanks.
Tony Lindgren Feb. 5, 2013, 6:56 p.m. UTC | #9
* Chen Gang <gang.chen@asianux.com> [130204 18:22]:
> ? 2013?02?05? 02:18, Tony Lindgren ??:
> > * Peter Ujfalusi <peter.ujfalusi@ti.com> [130204 01:04]:
> >> > Hi Tony,
> >> > 
> >> > I can create a branch for you in our gitorious tree
> >> > (git://gitorious.org/omap-audio/linux-audio.git) for this patch. But I think
> >> > for now it would be best if you could take this via linux-omap (the file is
> >> > under arch/arm/mach-omap2 anyways)
> > OK thanks I'll apply with your ack to omap-for-v3.9/fixes-noncritical.
> > 
> > Tony
> > 
> 
>   Does it mean: we need not sync MAINTAINERS file for twl-*, recently ?
> 
>   :-)

No we should still do it.

Tony
Chen Gang Feb. 6, 2013, 2:05 a.m. UTC | #10
? 2013?02?06? 02:56, Tony Lindgren ??:
> * Chen Gang <gang.chen@asianux.com> [130204 18:22]:
>> >   Does it mean: we need not sync MAINTAINERS file for twl-*, recently ?
>> > 
>> >   :-)
> No we should still do it.
> 
> Tony
> 

  ok, thanks.

  if necessary (no other members do it), I should perform.
  if really should I do:

    requirements:
      A) I should succeed provide at least 3 valuable patches to twl-*
           (or I am not qualified to provide the sync MAINTAINERS patch)

      B) relative member need give strictly checking for the patch.
           (so can evaluate whether I have been qualified)

      C) it is necessary to be monitored by the relative mailing lists.

    I should try:
      A) need mainly focus on the omap2, specially for twl-*

      B) the patch type should be for bug fixing:
           (I am not familiar with omap2, so can not for new features)
          i. memory override.
         ii. resource management.
        iii. others (compiling issue, type cast, ...)

      C) should provide 3 twl-* valuable patches within 1 month.
           (have finished one: strlcpy, in Jan 30 2013)
           (so need finish the other 2 patches, before Feb 28 2013)

    hope I can succeed.

    welcome any members to provide suggestions and completions.


  thanks.

  :-)
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
index e49b40b..6a7aec6 100644
--- a/arch/arm/mach-omap2/twl-common.c
+++ b/arch/arm/mach-omap2/twl-common.c
@@ -23,6 +23,7 @@ 
 #include <linux/i2c.h>
 #include <linux/i2c/twl.h>
 #include <linux/gpio.h>
+#include <linux/string.h>
 #include <linux/regulator/machine.h>
 #include <linux/regulator/fixed.h>
 
@@ -56,7 +57,7 @@  void __init omap_pmic_init(int bus, u32 clkrate,
 			   struct twl4030_platform_data *pmic_data)
 {
 	omap_mux_init_signal("sys_nirq", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
-	strncpy(pmic_i2c_board_info.type, pmic_type,
+	strlcpy(pmic_i2c_board_info.type, pmic_type,
 		sizeof(pmic_i2c_board_info.type));
 	pmic_i2c_board_info.irq = pmic_irq;
 	pmic_i2c_board_info.platform_data = pmic_data;