qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Shin-ichiro KAWASAKI <kawasaki@juno.dti.ne.jp>
To: qemu-devel@nongnu.org
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	[thread overview]
Message-ID: <49734152.7080302@juno.dti.ne.jp> (raw)
In-Reply-To: <4973267B.9010901@juno.dti.ne.jp>

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 <kawasaki@juno.dti.ne.jp>

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);

  parent reply	other threads:[~2009-01-18 14:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-16 19:04 [Qemu-devel] [6344] graphical_console_init change (Stefano Stabellini) Anthony Liguori
2009-01-18 12:54 ` Shin-ichiro KAWASAKI
2009-01-18 14:37   ` Aurelien Jarno
2009-01-18 14:48   ` Shin-ichiro KAWASAKI [this message]
2009-01-19 11:39     ` [PATCH] Adds null check for DisplayStatus (wasRe: " Stefano Stabellini
2009-01-19 15:26       ` Shin-ichiro KAWASAKI
2009-01-19 15:31         ` Stefano Stabellini
2009-01-19 16:08           ` Anthony Liguori
2009-01-19 16:19             ` Stefano Stabellini
2009-01-19 19:07               ` Anthony Liguori
2009-01-20 10:53                 ` [Qemu-devel] [PATCH] Adds null check for DisplayStatus Stefano Stabellini
2009-01-20 15:56                   ` Gerd Hoffmann
2009-01-20 16:36                     ` Stefano Stabellini
2009-01-21 11:06                   ` [Qemu-devel] " Stefano Stabellini
2009-01-21 18:59                   ` [Qemu-devel] " Anthony Liguori
2009-01-19 16:34       ` [PATCH] Adds null check for DisplayStatus (wasRe: [Qemu-devel] [6344] graphical_console_init change (Stefano Stabellini) Anthony Liguori
2009-02-09 11:38 ` Riku Voipio
2009-02-09 11:52   ` Stefano Stabellini
2009-02-09 17:00   ` Aurelien Jarno

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49734152.7080302@juno.dti.ne.jp \
    --to=kawasaki@juno.dti.ne.jp \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).