Skip to content

Commit

Permalink
[PATCH] sysfs: zero terminate sysfs write buffers
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
gregkh authored and Linus Torvalds committed Apr 2, 2006
1 parent 597a767 commit 6e0dd74
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/sysfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6e0dd74

Please sign in to comment.