Commit 5141a806 authored by Dave Jones's avatar Dave Jones Committed by Linus Torvalds

[PATCH] Sysfs not handling show errors

Originally by Rusty Lynch, munged by me, acked
by Mochel.

 Attempting to cat a sysfs file that returns an error will result in an
 endless dump of garbage to the screen because the result of the specific
 show operation was being saved to a size_t (unsigned) and then later
 checked for a negative value.
parent a978d779
...@@ -80,7 +80,7 @@ static int fill_read_buffer(struct file * file, struct sysfs_buffer * buffer) ...@@ -80,7 +80,7 @@ static int fill_read_buffer(struct file * file, struct sysfs_buffer * buffer)
struct kobject * kobj = file->f_dentry->d_parent->d_fsdata; struct kobject * kobj = file->f_dentry->d_parent->d_fsdata;
struct sysfs_ops * ops = buffer->ops; struct sysfs_ops * ops = buffer->ops;
int ret = 0; int ret = 0;
size_t count; ssize_t count;
if (!buffer->page) if (!buffer->page)
buffer->page = (char *) __get_free_page(GFP_KERNEL); buffer->page = (char *) __get_free_page(GFP_KERNEL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment