LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] SYSFS: Fix return values for sysdev_store_{ulong,int}
@ 2008-10-13 10:03 Andi Kleen
2008-10-16 20:35 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Andi Kleen @ 2008-10-13 10:03 UTC (permalink / raw)
To: greg, linux-kernel
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>
Index: linux/drivers/base/sys.c
===================================================================
--- linux.orig/drivers/base/sys.c
+++ linux/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);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] SYSFS: Fix return values for sysdev_store_{ulong,int}
2008-10-13 10:03 [PATCH] SYSFS: Fix return values for sysdev_store_{ulong,int} Andi Kleen
@ 2008-10-16 20:35 ` Andrew Morton
2008-10-17 6:25 ` Andi Kleen
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2008-10-16 20:35 UTC (permalink / raw)
To: Andi Kleen; +Cc: greg, linux-kernel
On Mon, 13 Oct 2008 12:03:03 +0200
Andi Kleen <andi@firstfloor.org> wrote:
> 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.
That sounds fairly serious. Is this a regression or are those versions
of echo really ancient, or...?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] SYSFS: Fix return values for sysdev_store_{ulong,int}
2008-10-16 20:35 ` Andrew Morton
@ 2008-10-17 6:25 ` Andi Kleen
0 siblings, 0 replies; 3+ messages in thread
From: Andi Kleen @ 2008-10-17 6:25 UTC (permalink / raw)
To: Andrew Morton; +Cc: Andi Kleen, greg, linux-kernel
On Thu, Oct 16, 2008 at 01:35:30PM -0700, Andrew Morton wrote:
> On Mon, 13 Oct 2008 12:03:03 +0200
> Andi Kleen <andi@firstfloor.org> wrote:
>
> > 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.
>
> That sounds fairly serious. Is this a regression or are those versions
> of echo really ancient, or...?
It's a regression, but it currently only affects the mce sysfs files,
which are the only ones using it. Also the EINVAL is more a cosmetic
issue because the first write will already change the value successfully,
only the second one will fail but not change anything.
-Andi
--
ak@linux.intel.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-10-17 6:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-13 10:03 [PATCH] SYSFS: Fix return values for sysdev_store_{ulong,int} Andi Kleen
2008-10-16 20:35 ` Andrew Morton
2008-10-17 6:25 ` Andi Kleen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).