WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-3.4-testing] minios: fix minios console

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-3.4-testing] minios: fix minios console
From: "Xen patchbot-3.4-testing" <patchbot-3.4-testing@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 23 Oct 2009 02:40:35 -0700
Delivery-date: Fri, 23 Oct 2009 02:41:29 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1256289576 -3600
# Node ID 774e2cf9d238e664ab61281671b1dcb0ab7da221
# Parent  5cc95e7456a86a5783ff4768eb4142ab1e058b54
minios: fix minios console

MiniOS' console_print tries to expand '\n' into "\n\r" in place,
causing page faults if the string resides in text.
Use a duplicate of the string instead.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
xen-unstable changeset:   20308:a95b55bf6c1a
xen-unstable date:        Wed Oct 14 08:55:43 2009 +0100
---
 extras/mini-os/console/console.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff -r 5cc95e7456a8 -r 774e2cf9d238 extras/mini-os/console/console.c
--- a/extras/mini-os/console/console.c  Fri Oct 23 10:17:32 2009 +0100
+++ b/extras/mini-os/console/console.c  Fri Oct 23 10:19:36 2009 +0100
@@ -79,6 +79,8 @@ void console_print(char *data, int lengt
 void console_print(char *data, int length)
 {
     char *curr_char, saved_char;
+    char copied_str[length];
+    char *copied_ptr;
     int part_len;
     int (*ring_send_fn)(const char *data, unsigned length);
 
@@ -87,23 +89,25 @@ void console_print(char *data, int lengt
     else
         ring_send_fn = xencons_ring_send;
         
-    for(curr_char = data; curr_char < data+length-1; curr_char++)
+    copied_ptr = copied_str;
+    memcpy(copied_ptr, data, length);
+    for(curr_char = copied_ptr; curr_char < copied_ptr+length-1; curr_char++)
     {
         if(*curr_char == '\n')
         {
             saved_char = *(curr_char+1);
             *(curr_char+1) = '\r';
-            part_len = curr_char - data + 2;
-            ring_send_fn(data, part_len);
+            part_len = curr_char - copied_ptr + 2;
+            ring_send_fn(dev, copied_ptr, part_len);
             *(curr_char+1) = saved_char;
-            data = curr_char+1;
+            copied_ptr = curr_char+1;
             length -= part_len - 1;
         }
     }
     
-    ring_send_fn(data, length);
+    ring_send_fn(dev, copied_ptr, length);
     
-    if(data[length-1] == '\n')
+    if(copied_ptr[length-1] == '\n')
         ring_send_fn("\r", 1);
 }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-3.4-testing] minios: fix minios console, Xen patchbot-3.4-testing <=