From nobody Wed Oct 1 04:55:30 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1583765688; cv=none; d=zohomail.com; s=zohoarc; b=PwwRujaeXra4ScL82Vt2NYTheIw8tm81cEpiqsAlVFd2nr67NcR1dXdGPoCHDeYd0ur0VQMFEENOSEfuqHxW34fG0jVuTs9pdmYQmoVLrWkEOBYgLx4yuGjYxoPLx4tEVR62244MfT1uDixcRlZb3BT2qMy7oJN7JU+IlGr2Lcg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583765688; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=pYKdxrjryGt0WdprCsuBcyDM5EOm1nNMBB46yKsk50Y=; b=ctXXB1SnrK6DL7kK+G4/tS1XYu4ThJKNAjstSOY5Rq1WXBATEqHQkoHjIfcWF+xQkf0anGpFR0Mq42xT0l/VpcFXHpCAEWD7IvjSgc37iBs1kBH1bkeAa7JFPOMEAvNLx6FRe73Jy72sQaTvcpwbAGXo4OKMtbYQG8vpeRDfj9M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1583765688176171.79815853581772; Mon, 9 Mar 2020 07:54:48 -0700 (PDT) Received: from localhost ([::1]:44258 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBJnr-0003Ln-2X for importer@patchew.org; Mon, 09 Mar 2020 10:54:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57814) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBJlD-00004q-KY for qemu-devel@nongnu.org; Mon, 09 Mar 2020 10:52:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jBJlC-0001lt-OL for qemu-devel@nongnu.org; Mon, 09 Mar 2020 10:52:03 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:40561 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jBJlC-0001lg-LC for qemu-devel@nongnu.org; Mon, 09 Mar 2020 10:52:02 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-437-Ad80-xYrMJyVm34lQwIfnA-1; Mon, 09 Mar 2020 10:52:00 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C1A91DB75 for ; Mon, 9 Mar 2020 14:51:59 +0000 (UTC) Received: from localhost (ovpn-112-63.ams2.redhat.com [10.36.112.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id AF9BE2718F; Mon, 9 Mar 2020 14:51:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583765522; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pYKdxrjryGt0WdprCsuBcyDM5EOm1nNMBB46yKsk50Y=; b=A+9iYWIPzgB+zCL/jgP9NJOtIDeCDL9kOJTPP8yN0+8I+N6l31efh7QGposObq2BBNrE4J VtQOPlfdhIpRQ39OtUhVSOSyIg5WfstxmQ9e0+TIck4FBQKf/daeKSe3Uy4MSY419hzU5C rJterEkK4lSfAZJx9pTznklE6BNh4Tc= X-MC-Unique: Ad80-xYrMJyVm34lQwIfnA-1 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH] softmmu: fix crash with invalid -M memory-backend= Date: Mon, 9 Mar 2020 15:51:55 +0100 Message-Id: <20200309145155.168942-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: imammedo@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Fixes: fe64d06afc1c5d895f220c268cfe4d5f1e65d44e ("vl.c: ensure that ram_size matches size of machine.memory-backend") Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- softmmu/vl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/softmmu/vl.c b/softmmu/vl.c index 5549f4b619..38e9c404f2 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -4287,6 +4287,11 @@ void qemu_init(int argc, char **argv, char **envp) =20 backend =3D object_resolve_path_type(current_machine->ram_memdev_i= d, TYPE_MEMORY_BACKEND, NULL); + if (!backend) { + error_report("Memory backend '%s' not found", + current_machine->ram_memdev_id); + exit(EXIT_FAILURE); + } backend_size =3D object_property_get_uint(backend, "size", &error= _abort); if (have_custom_ram_size && backend_size !=3D ram_size) { error_report("Size specified by -m option must match size = of " --=20 2.25.0.rc2.1.g09a9a1a997