1
0
Fork 0

[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>
hifive-unleashed-5.1
Greg Kroah-Hartman 2006-03-31 15:37:06 -08:00 committed by Linus Torvalds
parent 597a7679dd
commit 6e0dd741a8
1 changed files with 1 additions and 1 deletions

View File

@ -183,7 +183,7 @@ fill_write_buffer(struct sysfs_buffer * buffer, const char __user * buf, size_t
return -ENOMEM;
if (count >= PAGE_SIZE)
count = PAGE_SIZE;
count = PAGE_SIZE - 1;
error = copy_from_user(buffer->page,buf,count);
buffer->needs_read_fill = 1;
return error ? -EFAULT : count;