Re: [PATCH] configfs: Implement binary attributes (v3)

From: Chris Wulff
Date: Fri Jun 12 2015 - 22:10:23 EST


Pantelis Antoniou <pantelis.antoniou <at> konsulko.com> writes:

...
> +static ssize_t
> +configfs_write_bin_file(struct file *file, const char __user *buf,
> + size_t count, loff_t *ppos)
> +{
...
> + len = simple_write_to_buffer(buffer->bin_buffer,
> + buffer->bin_buffer_size, ppos, buf, count);
> + if (len > 0)
> + *ppos += len;
> +out:
> + mutex_unlock(&buffer->mutex);
> + return len;
> +}
> +
...

It appears there is a small bug in this code. If you write more than one page
worth of data it incorrectly skips ahead. This code should NOT increment ppos
as the simple_write_to_buffer call already does that for you.

-- Chris Wulff

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/