From nobody Sun Feb 8 14:12:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558079109; cv=none; d=zoho.com; s=zohoarc; b=Hq9zSe39bmQT302IUWAnFUXfrk9CW0PCl2Zkj6T3WOaltBk5tZQgYD0HWCAwjg5Zi+FHSOyXoisZ0JxtR8ZHBOyqRqW+39VQz/mqgyqPB1u/h6Ag8taxhmZ57t31AojB6QpkVOqE5h7ss6T57hLiqYnxVUH7GSKGXl1Kz1AGwKE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558079109; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=AK8qIHPmTXDAaP8ZY3JVZ0rs1bb/Rst2iJhaY5KNk3k=; b=cXRG+Th0UXG1nBikicqTttr/IsWbf0TLfRCPHINkq2YzQB+Ei5AZj/S98udqeGw4GLAvH3Dujm8bIVAwhN6EiLlV8i2h8XEXldgsRZ4ca92NjhscM1ofXCpoU10h0yHB5DWWWW47GU6KeaddjbwZSg09H+h+/lqE5m6ZNpILwoM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1558079109244942.1354454420891; Fri, 17 May 2019 00:45:09 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E7A757FDF5; Fri, 17 May 2019 07:45:01 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5F6005C241; Fri, 17 May 2019 07:44:58 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 741E21806B11; Fri, 17 May 2019 07:44:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4H7iomf025495 for ; Fri, 17 May 2019 03:44:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8446D17147; Fri, 17 May 2019 07:44:50 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E8CE5D6A9; Fri, 17 May 2019 07:44:49 +0000 (UTC) From: Igor Mammedov To: qemu-devel@nongnu.org Date: Fri, 17 May 2019 09:45:14 +0200 Message-Id: <1558079119-320634-2-git-send-email-imammedo@redhat.com> In-Reply-To: <1558079119-320634-1-git-send-email-imammedo@redhat.com> References: <1558079119-320634-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, pbonzini@redhat.com, ehabkost@redhat.com Subject: [libvirt] [PATCH v3 1/6] pc: fix possible NULL pointer dereference in pc_machine_get_device_memory_region_size() X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 17 May 2019 07:45:07 +0000 (UTC) Content-Type: text/plain; charset="utf-8" QEMU will crash when device-memory-region-size property is read if ms->devi= ce_memory wasn't initialized yet (ex: property being inspected during preconfig time). Instead of crashing return 0 if ms->device_memory hasn't been initialized. Signed-off-by: Igor Mammedov --- hw/i386/pc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index d98b737..de91e90 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -2461,7 +2461,11 @@ pc_machine_get_device_memory_region_size(Object *obj= , Visitor *v, Error **errp) { MachineState *ms =3D MACHINE(obj); - int64_t value =3D memory_region_size(&ms->device_memory->mr); + int64_t value =3D 0; + + if (ms->device_memory) { + memory_region_size(&ms->device_memory->mr); + } =20 visit_type_int(v, name, &value, errp); } --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list