summaryrefslogtreecommitdiff
path: root/fs/sysfs/bin.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/sysfs/bin.c')
-rw-r--r--fs/sysfs/bin.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c
index 006fc64227dd..aa244842f30b 100644
--- a/fs/sysfs/bin.c
+++ b/fs/sysfs/bin.c
@@ -62,6 +62,9 @@ read(struct file *file, char __user *userbuf, size_t bytes, loff_t *off)
loff_t offs = *off;
int count = min_t(size_t, bytes, PAGE_SIZE);
+ if (!bytes)
+ return 0;
+
if (size) {
if (offs > size)
return 0;
@@ -119,6 +122,9 @@ static ssize_t write(struct file *file, const char __user *userbuf,
loff_t offs = *off;
int count = min_t(size_t, bytes, PAGE_SIZE);
+ if (!bytes)
+ return 0;
+
if (size) {
if (offs > size)
return 0;