From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LOYxG-0004jX-4U for qemu-devel@nongnu.org; Sun, 18 Jan 2009 09:48:50 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LOYxF-0004iL-Gl for qemu-devel@nongnu.org; Sun, 18 Jan 2009 09:48:49 -0500 Received: from [199.232.76.173] (port=43900 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LOYxF-0004iF-AY for qemu-devel@nongnu.org; Sun, 18 Jan 2009 09:48:49 -0500 Received: from vsmtp04.dti.ne.jp ([202.216.231.139]:48343) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LOYxE-0008WC-IE for qemu-devel@nongnu.org; Sun, 18 Jan 2009 09:48:49 -0500 Received: from [192.168.1.21] (PPPa1787.e11.eacc.dti.ne.jp [124.255.93.17]) by vsmtp04.dti.ne.jp (3.11v) with ESMTP AUTH id n0IEmkLi008410 for ; Sun, 18 Jan 2009 23:48:46 +0900 (JST) Message-ID: <49734152.7080302@juno.dti.ne.jp> Date: Sun, 18 Jan 2009 23:48:50 +0900 From: Shin-ichiro KAWASAKI MIME-Version: 1.0 Subject: [PATCH] Adds null check for DisplayStatus (wasRe: [Qemu-devel] [6344] graphical_console_init change (Stefano Stabellini) References: <4973267B.9010901@juno.dti.ne.jp> In-Reply-To: <4973267B.9010901@juno.dti.ne.jp> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 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);