summaryrefslogtreecommitdiff
path: root/Documentation/filesystems/sysfs.txt
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2010-12-21 15:09:47 +0300
committerGreg Kroah-Hartman <gregkh@suse.de>2011-02-04 02:10:18 +0300
commitd3f70befd9a6ab79413f303109e2c701472e2785 (patch)
tree1a271b9744ac3b42355026e2cef7d9f97f9e8537 /Documentation/filesystems/sysfs.txt
parent5480bcdd60603f834b7c0c252213ca1932c28bfc (diff)
downloadlinux-d3f70befd9a6ab79413f303109e2c701472e2785.tar.xz
docs/sysfs: show() methods should use scnprintf().
Since snprintf() may return a value that exceeds its second argument, show() methods should use scnprintf() instead of snprintf(). This patch updates the example in the sysfs documentation accordingly. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Cc: Tejun Heo <tj@kernel.org> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'Documentation/filesystems/sysfs.txt')
-rw-r--r--Documentation/filesystems/sysfs.txt6
1 files changed, 3 insertions, 3 deletions
diff --git a/Documentation/filesystems/sysfs.txt b/Documentation/filesystems/sysfs.txt
index 2ed95f9b770a..f806e50aaa63 100644
--- a/Documentation/filesystems/sysfs.txt
+++ b/Documentation/filesystems/sysfs.txt
@@ -210,9 +210,9 @@ Other notes:
is 4096.
- show() methods should return the number of bytes printed into the
- buffer. This is the return value of snprintf().
+ buffer. This is the return value of scnprintf().
-- show() should always use snprintf().
+- show() should always use scnprintf().
- store() should return the number of bytes used from the buffer. If the
entire buffer has been used, just return the count argument.
@@ -231,7 +231,7 @@ A very simple (and naive) implementation of a device attribute is:
static ssize_t show_name(struct device *dev, struct device_attribute *attr,
char *buf)
{
- return snprintf(buf, PAGE_SIZE, "%s\n", dev->name);
+ return scnprintf(buf, PAGE_SIZE, "%s\n", dev->name);
}
static ssize_t store_name(struct device *dev, struct device_attribute *attr,