qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Adds null check for DisplayStatus (wasRe: [Qemu-devel] [6344] gr


From: Shin-ichiro KAWASAKI
Subject: [PATCH] Adds null check for DisplayStatus (wasRe: [Qemu-devel] [6344] graphical_console_init change (Stefano Stabellini)
Date: Sun, 18 Jan 2009 23:48:50 +0900
User-agent: Thunderbird 2.0.0.19 (Windows/20081209)

Shin-ichiro KAWASAKI wrote:
Hi.

Anthony Liguori wrote:
Revision: 6344
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6344
Author:   aliguori
Date:     2009-01-16 19:04:14 +0000 (Fri, 16 Jan 2009)

Log Message:
-----------
graphical_console_init change (Stefano Stabellini)

(snip)

Modified: trunk/vl.c
===================================================================
--- trunk/vl.c    2009-01-16 18:13:32 UTC (rev 6343)
+++ trunk/vl.c    2009-01-16 19:04:14 UTC (rev 6344)
(snip)
+    /* just use the first displaystate for the moment */
+    ds = display_state;
     /* terminal init */
-    memset(&display_state, 0, sizeof(display_state));
-    ds->surface = qemu_create_displaysurface(640, 480, 32, 640 * 4);
     if (nographic) {
         if (curses) {
fprintf(stderr, "fatal: -nographic can't be used with -curses\n");

This commit seems to cause segmentation fault for boards which has no graphics display. I saw the fault when I working with my SE7750 board support patch, and invoking with -nographic options. The fault happens in dump_display_init(ds) within the 'if (nographic)' block quoted above. The argument ds is NULL because no graphic board initialize it, I guess. Some null check for ds or dummy ds might
be needed, for such cases.

I'm sending the patch which solves the problem above.
Could anyone evaluate it?

Regards,
Shin-ichiro KAWASAKI


Signed-off-by: Shin-ichiro KAWASAKI <address@hidden>

Index: trunk/vl.c
===================================================================
--- trunk/vl.c  (revision 6365)
+++ trunk/vl.c  (working copy)
@@ -5544,7 +5544,8 @@
            exit(1);
        }
        /* nearly nothing to do */
-        dumb_display_init(ds);
+       if (ds)
+           dumb_display_init(ds);
} else { #if defined(CONFIG_CURSES)
            if (curses) {
@@ -5568,18 +5569,21 @@
#endif
            }
    }
-    dpy_resize(ds);
+    if (ds) {
+       dpy_resize(ds);

-    dcl = ds->listeners;
-    while (dcl != NULL) {
-        if (dcl->dpy_refresh != NULL) {
-            ds->gui_timer = qemu_new_timer(rt_clock, gui_update, ds);
-            qemu_mod_timer(ds->gui_timer, qemu_get_clock(rt_clock));
-        }
-        dcl = dcl->next;
+       dcl = ds->listeners;
+       while (dcl != NULL) {
+           if (dcl->dpy_refresh != NULL) {
+               ds->gui_timer = qemu_new_timer(rt_clock, gui_update, ds);
+               qemu_mod_timer(ds->gui_timer, qemu_get_clock(rt_clock));
+           }
+           dcl = dcl->next;
+       }
    }

-    text_consoles_set_display(display_state);
+    if (display_state)
+       text_consoles_set_display(display_state);

    if (monitor_device && monitor_hd)
        monitor_init(monitor_hd, !nographic);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]