summaryrefslogtreecommitdiffstats
path: root/kernel/sysctl_binary.c
diff options
context:
space:
mode:
authorChen Gang <gang.chen@asianux.com>2013-11-12 15:11:22 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 12:09:33 +0900
commitf02147ef190b3963bb61ec0e140ec47f22889f38 (patch)
treed1680ec59e387e322fea04bc4e25991fee46bc54 /kernel/sysctl_binary.c
parent7833819d2e5b2a0189f6e9d445ba03f4d7ba2656 (diff)
downloadlinux-stable-f02147ef190b3963bb61ec0e140ec47f22889f38.tar.gz
linux-stable-f02147ef190b3963bb61ec0e140ec47f22889f38.tar.bz2
linux-stable-f02147ef190b3963bb61ec0e140ec47f22889f38.zip
kernel/sysctl_binary.c: use scnprintf() instead of snprintf()
snprintf() will return the 'ideal' length which may be larger than real buffer length, if we only want to use real length, need use scnprintf() instead of. Signed-off-by: Chen Gang <gang.chen@asianux.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/sysctl_binary.c')
-rw-r--r--kernel/sysctl_binary.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c
index b609213ca9a2..653cbbd9e7ad 100644
--- a/kernel/sysctl_binary.c
+++ b/kernel/sysctl_binary.c
@@ -1024,7 +1024,7 @@ static ssize_t bin_intvec(struct file *file,
if (get_user(value, vec + i))
goto out_kfree;
- str += snprintf(str, end - str, "%lu\t", value);
+ str += scnprintf(str, end - str, "%lu\t", value);
}
result = kernel_write(file, buffer, str - buffer, 0);
@@ -1095,7 +1095,7 @@ static ssize_t bin_ulongvec(struct file *file,
if (get_user(value, vec + i))
goto out_kfree;
- str += snprintf(str, end - str, "%lu\t", value);
+ str += scnprintf(str, end - str, "%lu\t", value);
}
result = kernel_write(file, buffer, str - buffer, 0);
@@ -1205,7 +1205,7 @@ static ssize_t bin_dn_node_address(struct file *file,
if (get_user(dnaddr, (__le16 __user *)newval))
goto out;
- len = snprintf(buf, sizeof(buf), "%hu.%hu",
+ len = scnprintf(buf, sizeof(buf), "%hu.%hu",
le16_to_cpu(dnaddr) >> 10,
le16_to_cpu(dnaddr) & 0x3ff);