arch: arm: mach-msm: using strlcpy instead of strncpy
authorChen Gang <gang.chen@asianux.com>
Sun, 26 May 2013 06:54:34 +0000 (14:54 +0800)
committerDavid Brown <davidb@codeaurora.org>
Fri, 31 May 2013 15:46:09 +0000 (08:46 -0700)
For NULL terminated string, need always be sure of ended by zero.

Or the next 'ptr' in 'for' looping may cause issue.

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Signed-off-by: David Brown <davidb@codeaurora.org>
arch/arm/mach-msm/clock-debug.c

index 4886404d42f587533c175e5474fdedcc4ccd680b..b0fbdf1cbdd15040709940826fe013b4c637b51d 100644 (file)
@@ -104,7 +104,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);