diff options
-rw-r--r-- | fs/libfs.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/libfs.c b/fs/libfs.c index 662a28e4f667..219576c52d80 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -739,10 +739,11 @@ ssize_t simple_attr_write(struct file *file, const char __user *buf, | |||
739 | if (copy_from_user(attr->set_buf, buf, size)) | 739 | if (copy_from_user(attr->set_buf, buf, size)) |
740 | goto out; | 740 | goto out; |
741 | 741 | ||
742 | ret = len; /* claim we got the whole input */ | ||
743 | attr->set_buf[size] = '\0'; | 742 | attr->set_buf[size] = '\0'; |
744 | val = simple_strtol(attr->set_buf, NULL, 0); | 743 | val = simple_strtol(attr->set_buf, NULL, 0); |
745 | attr->set(attr->data, val); | 744 | ret = attr->set(attr->data, val); |
745 | if (ret == 0) | ||
746 | ret = len; /* on success, claim we got the whole input */ | ||
746 | out: | 747 | out: |
747 | mutex_unlock(&attr->mutex); | 748 | mutex_unlock(&attr->mutex); |
748 | return ret; | 749 | return ret; |