Re: [patch 04/15] cleanup clocksource selection



On Fri, 14 Aug 2009 18:42:20 -0700
john stultz <johnstul@xxxxxxxxxx> 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.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • IE6 Script Error
    ... The error has been occuring for some ... Char: 38 ... Other web pages are also showing minor errors; ... How does one determine what function is causing the problem and how does one ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: Help with console scrolling problem (RELENG54)
    ... > Is there anyway of writing to the last without causing the ... > to be any way to avoid scrolling. ... Look at how ncurses is doing it. ... one char. ...
    (freebsd-hackers)
  • Re: int urldecode(char *src, char *last, char *dest)
    ... As well as causing a buffer overflow if the text ... char *post{ ... meaning safety code with no memory leaks or ...
    (comp.lang.c)
  • .setfocus not going to proper field
    ... I have a 4 char "year" field. ... to make sure they are not entering a previous year. ... What could be causing this?? ... Brad ...
    (microsoft.public.access.formscoding)
  • Writer Job Status - API QSPROUTQ
    ... I used following CL code to retrieve the Writer Job Status, ... DCL &APIERR *CHAR 16 ... &WRTJSTS - Showed empty even thought I found the OUTQ in Status MSGW. ...
    (comp.sys.ibm.as400.misc)

Loading