提交 4e318d7c 编写于 作者: A Andi Kleen 提交者: Greg Kroah-Hartman

sysfs: Fix return values for sysdev_store_{ulong,int}

SYSFS: Fix return values for sysdev_store_{ulong,int}

Always return the full size instead of the consumed
length of the string in sysdev_store_{ulong,int}

This avoids EINVAL errors in some echo versions.
Signed-off-by: NAndi Kleen <ak@linux.intel.com>
Cc: stable <stable@kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 65151365
......@@ -488,7 +488,8 @@ ssize_t sysdev_store_ulong(struct sys_device *sysdev,
if (end == buf)
return -EINVAL;
*(unsigned long *)(ea->var) = new;
return end - buf;
/* Always return full write size even if we didn't consume all */
return size;
}
EXPORT_SYMBOL_GPL(sysdev_store_ulong);
......@@ -511,7 +512,8 @@ ssize_t sysdev_store_int(struct sys_device *sysdev,
if (end == buf || new > INT_MAX || new < INT_MIN)
return -EINVAL;
*(int *)(ea->var) = new;
return end - buf;
/* Always return full write size even if we didn't consume all */
return size;
}
EXPORT_SYMBOL_GPL(sysdev_store_int);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册