diff options
author | Seymour, Shane M <shane.seymour@hp.com> | 2015-06-25 05:33:08 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-08-06 01:13:21 +0300 |
commit | 223e8f01b072152cc4336e7dcb1cf8c21ab34432 (patch) | |
tree | a134721836ea2d02c85d31383fd751e4fb78e9e5 /Documentation/filesystems/sysfs.txt | |
parent | 64526370d11ce8868ca495723d595b61e8697fbf (diff) | |
download | linux-223e8f01b072152cc4336e7dcb1cf8c21ab34432.tar.xz |
sysfs.txt: update show method notes about sprintf/snprintf/scnprintf usage
Changed the documentation to allow sprintf() when the buffer
provided by sysfs cannot be overflowed. Explicitly say
snprintf() must never be used in a show function to format
data to be returned to user space.
Change based on a discussion about the patch
st: convert DRIVER_ATTR macros to DRIVER_ATTR_RO
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Shane Seymour <shane.seymour@hp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'Documentation/filesystems/sysfs.txt')
-rw-r--r-- | Documentation/filesystems/sysfs.txt | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Documentation/filesystems/sysfs.txt b/Documentation/filesystems/sysfs.txt index b35a64b82f9e..9494afb9476a 100644 --- a/Documentation/filesystems/sysfs.txt +++ b/Documentation/filesystems/sysfs.txt @@ -212,7 +212,10 @@ Other notes: - show() methods should return the number of bytes printed into the buffer. This is the return value of scnprintf(). -- show() should always use scnprintf(). +- show() must not use snprintf() when formatting the value to be + returned to user space. If you can guarantee that an overflow + will never happen you can use sprintf() otherwise you must 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. |