Commit 05cc0cee authored by Wu Fengguang's avatar Wu Fengguang Committed by Al Viro

libfs: return error code on failed attr set

Currently all simple_attr.set handlers return 0 on success and negative
codes on error.  Fix simple_attr_write() to return these error codes.
Signed-off-by: default avatarWu Fengguang <>
Cc: Theodore Ts'o <>
Cc: Al Viro <>
Cc: Christoph Hellwig <>
Cc: Nick Piggin <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarAl Viro <>
parent 7a62cc10
......@@ -739,10 +739,11 @@ ssize_t simple_attr_write(struct file *file, const char __user *buf,
if (copy_from_user(attr->set_buf, buf, size))
goto out;
ret = len; /* claim we got the whole input */
attr->set_buf[size] = '\0';
val = simple_strtol(attr->set_buf, NULL, 0);
attr->set(attr->data, val);
ret = attr->set(attr->data, val);
if (ret == 0)
ret = len; /* on success, claim we got the whole input */
return ret;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment