From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41038) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YRVrr-0004ZW-Jl for qemu-devel@nongnu.org; Fri, 27 Feb 2015 20:06:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YRVro-0007Ym-77 for qemu-devel@nongnu.org; Fri, 27 Feb 2015 20:06:55 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:48586) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YRVrn-0007YU-JV for qemu-devel@nongnu.org; Fri, 27 Feb 2015 20:06:52 -0500 Message-ID: <54F1148B.3010105@huawei.com> Date: Sat, 28 Feb 2015 09:06:19 +0800 From: Gonglei MIME-Version: 1.0 References: <1425001784-6752-1-git-send-email-arei.gonglei@huawei.com> <54F07C06.1090808@redhat.com> In-Reply-To: <54F07C06.1090808@redhat.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] bootdevice: fix segment fault when booting guest with '-kernel' and '-initrd' List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org Cc: peter.huangpeng@huawei.com, edivaldoapereira@yahoo.com.br On 2015/2/27 22:15, Paolo Bonzini wrote: > Looks good, I am applying it locally so that it can get into qemu.git > very soon. > OK, thanks. Regards, -Gonglei > Paolo > > On 27/02/2015 02:49, arei.gonglei@huawei.com wrote: >> From: Gonglei >> >> Reproducer: >> >> $./qemu-system-x86_64 --enable-kvm -kernel /home/vmlinuz-2.6.32.12-0.7-default \ >> -initrd /home/initrd-2.6.32.12-0.7-default -append \ >> "root=/dev/ram rw console=ttyS0,115200" -dtb guest.dtb -vnc :10 --monitor stdio -smp 2 >> QEMU 2.2.50 monitor - type 'help' for more information >> (qemu) Segmentation fault (core dumped) >> >> Reported-by: Edivaldo de Araujo Pereira >> Signed-off-by: Gonglei >> --- >> bootdevice.c | 13 +++++++++---- >> 1 file changed, 9 insertions(+), 4 deletions(-) >> >> diff --git a/bootdevice.c b/bootdevice.c >> index df9ab0e..673bfef 100644 >> --- a/bootdevice.c >> +++ b/bootdevice.c >> @@ -223,10 +223,15 @@ char *get_boot_devices_list(size_t *size, bool ignore_suffixes) >> } >> >> if (!ignore_suffixes) { >> - d = qdev_get_own_fw_dev_path_from_handler(i->dev->parent_bus, i->dev); >> - if (d) { >> - assert(!i->suffix); >> - suffix = d; >> + if (i->dev) { >> + d = qdev_get_own_fw_dev_path_from_handler(i->dev->parent_bus, >> + i->dev); >> + if (d) { >> + assert(!i->suffix); >> + suffix = d; >> + } else { >> + suffix = g_strdup(i->suffix); >> + } >> } else { >> suffix = g_strdup(i->suffix); >> } >>