diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2006-03-31 18:37:06 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-04-02 16:03:31 -0400 |
commit | 6e0dd741a89be35defa05bd79f4211c5a2762825 (patch) | |
tree | 565d0328e9e353884e9d5785590e6d4be99e0964 | |
parent | 597a7679dd83691be2f3a53e1f3f915b4a7f6eba (diff) |
[PATCH] sysfs: zero terminate sysfs write buffers
No one should be writing a PAGE_SIZE worth of data to a normal sysfs
file, so properly terminate the buffer.
Thanks to Al Viro for pointing out my supidity here.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | fs/sysfs/file.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 830f76fa098c..f1cb1ddde511 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
@@ -183,7 +183,7 @@ fill_write_buffer(struct sysfs_buffer * buffer, const char __user * buf, size_t | |||
183 | return -ENOMEM; | 183 | return -ENOMEM; |
184 | 184 | ||
185 | if (count >= PAGE_SIZE) | 185 | if (count >= PAGE_SIZE) |
186 | count = PAGE_SIZE; | 186 | count = PAGE_SIZE - 1; |
187 | error = copy_from_user(buffer->page,buf,count); | 187 | error = copy_from_user(buffer->page,buf,count); |
188 | buffer->needs_read_fill = 1; | 188 | buffer->needs_read_fill = 1; |
189 | return error ? -EFAULT : count; | 189 | return error ? -EFAULT : count; |