Received: from eggs.gnu.org ([2001:4830:134:3::10]:37991) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHuM4-0006kj-5i for qemu-devel@nongnu.org; Tue, 28 Jun 2016 10:51:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bHuM0-0005fr-TL for qemu-devel@nongnu.org; Tue, 28 Jun 2016 10:51:12 -0400 Received: from indium.canonical.com ([91.189.90.7]:59490) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHuM0-0005fb-NB for qemu-devel@nongnu.org; Tue, 28 Jun 2016 10:51:08 -0400 Received: from loganberry.canonical.com ([91.189.90.37]) by indium.canonical.com with esmtp (Exim 4.76 #1 (Debian)) id 1bHuLz-0002Be-GC for ; Tue, 28 Jun 2016 14:51:07 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 325C52E80EC for ; Tue, 28 Jun 2016 14:51:03 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Date: Tue, 28 Jun 2016 14:43:46 -0000 From: "T. Huth" <1240669@bugs.launchpad.net> Reply-To: Bug 1240669 <1240669@bugs.launchpad.net> Sender: bounces@canonical.com References: <20131016191858.16237.90141.malonedeb@soybean.canonical.com> Message-Id: <20160628144347.31209.34375.launchpad@chaenomeles.canonical.com> Errors-To: bounces@canonical.com Subject: [Qemu-devel] [Bug 1240669] Re: sd_init() generates SIGSEGV when passed NULL List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org ** Changed in: qemu Status: Fix Committed =3D> Fix Released -- = You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1240669 Title: sd_init() generates SIGSEGV when passed NULL Status in QEMU: Fix Released Bug description: Ran into a bug following the following tutorial: http://balau82.wordpress.com/2010/03/10/u-boot-for-arm-on-qemu/ I built QEMU from a clone of master and became stuck at the beginning part of the tutorial where only u-boot.bin is exectuted. http://git.qemu.org/?p=3Dqemu.git;a=3Dcommitdiff;h=3D4f8a066b5fc254eeaabb= bde56ba4f5b29cc68fdf See the modifications to sd.c specifically. When sd_init (sd.c) is called from pl181_init(), bs is potentially null: s->card =3D sd_init(dinfo ? dinfo->bdrv : NULL, false); sd_init(): SDState *sd_init(BlockDriverState *bs, bool is_spi) = { = SDState *sd; = = if (bdrv_is_read_only(bs)) { = fprintf(stderr, "sd_init: Cannot use read-only drive\n"); = return NULL; = } = = sd =3D (SDState *) g_malloc0(sizeof(SDState)); = sd->buf =3D qemu_blockalign(bs, 512); = sd->spi =3D is_spi; = sd->enable =3D true; = sd_reset(sd, bs); = if (sd->bdrv) { = bdrv_attach_dev_nofail(sd->bdrv, sd); = bdrv_set_dev_ops(sd->bdrv, &sd_block_ops, sd); = } = vmstate_register(NULL, -1, &sd_vmstate, sd); = return sd; = } = Line 497 calls bdrv_is_read_only(bs) (from block.c)and this generates a S= EGSIGV. int bdrv_is_read_only(BlockDriverState *bs) { =C2=A0=C2=A0=C2=A0=C2=A0return bs->read_only; } Checking out tag v1.6.1 reverted the problem. Thanks! To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1240669/+subscriptions