]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] sysfs error handling fix
authorAndrew Morton <akpm@digeo.com>
Thu, 13 Feb 2003 01:39:58 +0000 (17:39 -0800)
committerVojtech Pavlik <vojtech@kernel.bkbits.net>
Thu, 13 Feb 2003 01:39:58 +0000 (17:39 -0800)
Patch from: Rusty Lynch <rusty@linux.co.intel.com>

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.

Here is a trivial patch to fix the error.

fs/sysfs/inode.c

index b37daa8ab22ea7fa804299351e21f2cfcad25f5b..df09960cd1eafb16a8d17132eadd8c8554f09a78 100644 (file)
@@ -210,7 +210,7 @@ static int fill_read_buffer(struct file * file, struct sysfs_buffer * buffer)
        struct kobject * kobj = file->f_dentry->d_parent->d_fsdata;
        struct sysfs_ops * ops = buffer->ops;
        int ret = 0;
-       size_t count;
+       ssize_t count;
 
        if (!buffer->page)
                buffer->page = (char *) __get_free_page(GFP_KERNEL);