]> git.baikalelectronics.ru Git - kernel.git/commit
sysfs: sysfs_write_file() writes zero terminated data
authorThomas Maier <balagi@justmail.de>
Sun, 22 Oct 2006 17:17:47 +0000 (19:17 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 1 Dec 2006 22:52:01 +0000 (14:52 -0800)
commit94d89adb113c1d21e1a318f5e0cb84db4ecd6f0b
tree2607c8c03a719e4aa4bbbe46ca4ee3eb490755b5
parent7d0a9158be487a5d0fe5b96dd47bc3b98492aa27
sysfs: sysfs_write_file() writes zero terminated data

since most of the files in sysfs are text files,
it would be nice, if the "store" function called
during sysfs_write_file() gets a zero terminated
string / data.
The current implementation seems not to ensure this.
(But only if it is the first time the zeroed buffer
page is allocated.)

So the buffer can be scanned by sscanf() easily,
for example.

This patch simply sets a \0 char behind the
data in buffer->page.

Signed-off-by: Thomas Maier <balagi@justmail.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/sysfs/file.c