direct-io.hg

changeset 10324:92f071926e6e

[XEN] Fix read_console_ring() when passed a small buffer.
From: Akio Takebe <takebe_akio@jp.fujitsu.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Mon Jun 12 10:05:55 2006 +0100 (2006-06-12)
parents a936c9c3ea60
children 9d717a4f3531
files xen/drivers/char/console.c
line diff
     1.1 --- a/xen/drivers/char/console.c	Mon Jun 12 09:57:23 2006 +0100
     1.2 +++ b/xen/drivers/char/console.c	Mon Jun 12 10:05:55 2006 +0100
     1.3 @@ -230,7 +230,7 @@ long read_console_ring(XEN_GUEST_HANDLE(
     1.4      sofar = 0;
     1.5  
     1.6      c = conringc;
     1.7 -    while ( c != conringp )
     1.8 +    while ( (c != conringp) && (sofar < max) )
     1.9      {
    1.10          idx = CONRING_IDX_MASK(c);
    1.11          len = conringp - c;
    1.12 @@ -247,7 +247,10 @@ long read_console_ring(XEN_GUEST_HANDLE(
    1.13      if ( clear )
    1.14      {
    1.15          spin_lock_irqsave(&console_lock, flags);
    1.16 -        conringc = conringp;
    1.17 +        if ( (conringp - c) > CONRING_SIZE )
    1.18 +            conringc = conringp - CONRING_SIZE;
    1.19 +        else
    1.20 +            conringc = c;
    1.21          spin_unlock_irqrestore(&console_lock, flags);
    1.22      }
    1.23