lkml.org 
[lkml]   [2009]   [Aug]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 04/15] cleanup clocksource selection
On Fri, 14 Aug 2009 18:42:20 -0700
john stultz <johnstul@us.ibm.com> wrote:

> Here when you return count, count may have been decremented in the code
> above, which causes the writer to get back fewer bytes then what they
> passed in, causing the last char to be repeatedly sent. This is what
> causes the immediate switch back to the default clocksource (override
> gets set to null), and the hang of the command writing to the sysfs
> file.
>
> The fix is simply keeping the initial "size_t ret = count;" and the
> final "return ret;"
>
>
> Index: linux-2.6-tip/kernel/time/clocksource.c
> ===================================================================
> --- linux-2.6-tip.orig/kernel/time/clocksource.c 2009-08-14 17:29:50.000000000 -0400
> +++ linux-2.6-tip/kernel/time/clocksource.c 2009-08-14 17:30:36.000000000 -0400
> @@ -478,6 +478,8 @@
> struct sysdev_attribute *attr,
> const char *buf, size_t count)
> {
> + size_t ret = count;
> +
> /* strings from sysfs write are not 0 terminated! */
> if (count >= sizeof(override_name))
> return -EINVAL;
> @@ -495,7 +497,7 @@
>
> spin_unlock_irq(&clocksource_lock);
>
> - return count;
> + return ret;
> }
>
> /**

Opps :-(
Thanks for bisecting & fixing.

--
blue skies,
Martin.

"Reality continues to ruin my life." - Calvin.



\
 
 \ /
  Last update: 2009-08-17 09:37    [W:0.122 / U:5.180 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site