diff options
author | Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> | 2010-08-25 15:19:53 -0400 |
---|---|---|
committer | Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> | 2010-08-25 15:19:53 -0400 |
commit | fb27cfbcbd2865b0e731c4aae47df71778da805e (patch) | |
tree | bc321b782bb4234a7d6a5cb019c31c3843ab2506 /drivers/xen | |
parent | 6280f190da4dd083f14f704be6b3314311a7eacb (diff) |
xenfs/xenbus: report partial reads/writes correctly
copy_(to|from)_user return the number of uncopied bytes, so a successful
return is 0, and any non-zero result indicates some degree of failure.
Reported-by: "Jun Zhu (Intern)" <Jun.Zhu@citrix.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Diffstat (limited to 'drivers/xen')
-rw-r--r-- | drivers/xen/xenfs/xenbus.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/xen/xenfs/xenbus.c b/drivers/xen/xenfs/xenbus.c index 9d5b519d2e4c..d2a905826804 100644 --- a/drivers/xen/xenfs/xenbus.c +++ b/drivers/xen/xenfs/xenbus.c | |||
@@ -142,7 +142,7 @@ static ssize_t xenbus_file_read(struct file *filp, | |||
142 | i += sz - ret; | 142 | i += sz - ret; |
143 | rb->cons += sz - ret; | 143 | rb->cons += sz - ret; |
144 | 144 | ||
145 | if (ret != sz) { | 145 | if (ret != 0) { |
146 | if (i == 0) | 146 | if (i == 0) |
147 | i = -EFAULT; | 147 | i = -EFAULT; |
148 | goto out; | 148 | goto out; |
@@ -453,7 +453,7 @@ static ssize_t xenbus_file_write(struct file *filp, | |||
453 | 453 | ||
454 | ret = copy_from_user(u->u.buffer + u->len, ubuf, len); | 454 | ret = copy_from_user(u->u.buffer + u->len, ubuf, len); |
455 | 455 | ||
456 | if (ret == len) { | 456 | if (ret != 0) { |
457 | rc = -EFAULT; | 457 | rc = -EFAULT; |
458 | goto out; | 458 | goto out; |
459 | } | 459 | } |