configfs: use capped length for ->store_attribute()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 3 Jul 2013 22:00:45 +0000 (15:00 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 3 Jul 2013 23:07:23 +0000 (16:07 -0700)
The difference between "count" and "len" is that "len" is capped at
4095.  Changing it like this makes it match how sysfs_write_file() is
implemented.

This is a static analysis patch.  I haven't found any store_attribute()
functions where this change makes a difference.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Joel Becker <jlbec@evilplan.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/configfs/file.c

index 2b6cb23dd14e99a4165af595a1f6670e002d8d3b..1d1c41f1014d9039c0a3ec217d6c6e53856760b1 100644 (file)
@@ -203,7 +203,7 @@ configfs_write_file(struct file *file, const char __user *buf, size_t count, lof
        mutex_lock(&buffer->mutex);
        len = fill_write_buffer(buffer, buf, count);
        if (len > 0)
-               len = flush_write_buffer(file->f_path.dentry, buffer, count);
+               len = flush_write_buffer(file->f_path.dentry, buffer, len);
        if (len > 0)
                *ppos += len;
        mutex_unlock(&buffer->mutex);