| From jejb@kernel.org Tue Nov 4 11:34:23 2008 |
| From: Andi Kleen <andi@firstfloor.org> |
| Date: Thu, 30 Oct 2008 19:10:08 GMT |
| Subject: sysfs: Fix return values for sysdev_store_{ulong, int} |
| To: jejb@kernel.org, stable@kernel.org |
| Message-ID: <200810301910.m9UJA8qi013019@hera.kernel.org> |
| |
| From: Andi Kleen <andi@firstfloor.org> |
| |
| commit 4e318d7c6c9dd5cdae48bcf61558bbc0c09b12ac upstream |
| |
| 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: Andi Kleen <ak@linux.intel.com> |
| Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> |
| |
| --- |
| drivers/base/sys.c | 6 ++++-- |
| 1 file changed, 4 insertions(+), 2 deletions(-) |
| |
| --- a/drivers/base/sys.c |
| +++ b/drivers/base/sys.c |
| @@ -488,7 +488,8 @@ ssize_t sysdev_store_ulong(struct sys_de |
| 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_devi |
| 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); |
| |