mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 11:46:19 +00:00
sysfs: fix problems with binary files
Some sysfs binary files don't like having 0 passed to them as a size. Fix this up at the root by just returning to the vfs if userspace asks us for a zero sized buffer. Thanks to Pavel Roskin for pointing this out. Reported-by: Pavel Roskin <proski@gnu.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
72638f598e
commit
4503efd089
1 changed files with 6 additions and 0 deletions
|
@ -63,6 +63,9 @@ read(struct file *file, char __user *userbuf, size_t bytes, loff_t *off)
|
||||||
int count = min_t(size_t, bytes, PAGE_SIZE);
|
int count = min_t(size_t, bytes, PAGE_SIZE);
|
||||||
char *temp;
|
char *temp;
|
||||||
|
|
||||||
|
if (!bytes)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (size) {
|
if (size) {
|
||||||
if (offs > size)
|
if (offs > size)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -131,6 +134,9 @@ static ssize_t write(struct file *file, const char __user *userbuf,
|
||||||
int count = min_t(size_t, bytes, PAGE_SIZE);
|
int count = min_t(size_t, bytes, PAGE_SIZE);
|
||||||
char *temp;
|
char *temp;
|
||||||
|
|
||||||
|
if (!bytes)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (size) {
|
if (size) {
|
||||||
if (offs > size)
|
if (offs > size)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue