From nobody Wed Nov 5 07:55:54 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1533824134657883.8907270897146; Thu, 9 Aug 2018 07:15:34 -0700 (PDT) Received: from localhost ([::1]:51063 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnliv-0008Ra-HK for importer@patchew.org; Thu, 09 Aug 2018 10:15:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnlhb-0007VB-G3 for qemu-devel@nongnu.org; Thu, 09 Aug 2018 10:14:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnlha-0000V8-KL for qemu-devel@nongnu.org; Thu, 09 Aug 2018 10:14:11 -0400 Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::6]:16269) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnlha-0000Tu-4X for qemu-devel@nongnu.org; Thu, 09 Aug 2018 10:14:10 -0400 Received: from sender by smtp.strato.de (RZmta 43.15 AUTH) with ESMTPSA id d07a67u79EE46TC (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Thu, 9 Aug 2018 16:14:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1533824046; s=strato-dkim-0002; d=aepfle.de; h=Message-Id:Date:Subject:Cc:To:From:X-RZG-CLASS-ID:X-RZG-AUTH:From: Subject:Sender; bh=OBx8toP7oIPYH8aif9f6Nps7g1Op096+qk1dtYdUJJc=; b=AzWEMHjDwuGcZoE9iPQow1ltu9Lj1p1n/6HF31XogGIWvCCpL4yxUsqit36yaMP753 2ekhogeSmmvyRVQP1OI0yjNpUJ03tHZ+pM1wNkqlCvHDQgjCsVBnM3fG9oghoqHQSjae qvtB8IpJjHUkxnowxi1T/SVBytSnxGeVIxQqmCLKvcPrSsGvu9yB7HJz37pdhFyDlRfb ERyQ4N6tD4ElsQmMy2oxecGXB0AM/rQZrQqaOilzQCqZpWhwrA+JoPRjSiCKWJ2JfQ42 LiDQnt5+IcrTkogkskMfvewppzM0fJx0yVqokScgp52jb4QM4UELi3odAcrpWfh8bKW/ 7K7w== X-RZG-AUTH: ":P2EQZWCpfu+qG7CngxMFH1J+3q8wa/QXkBR9MXjAuzpOGUivpc0WAr0t3Sj8140FKdfYth0=" X-RZG-CLASS-ID: mo00 From: Olaf Hering To: Paolo Bonzini , Peter Crosthwaite , Richard Henderson , qemu-devel@nongnu.org (open list:Overall) Date: Thu, 9 Aug 2018 16:14:03 +0200 Message-Id: <20180809141403.11296-1-olaf@aepfle.de> X-Mailer: git-send-email 2.16.4 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 2a01:238:20a:202:5300::6 Subject: [Qemu-devel] [PATCH v1] exec: handle NULL pointer in flatview_read_continue X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Olaf Hering Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The codepaths behind qemu_ram_ptr_length can return NULL. Avoid crashing the device-model in such case, just move on. Signed-off-by: Olaf Hering --- This happens if calling xendevicemodel_create_ioreq_server() is disabled, and eventually if that function returns an error. --- exec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exec.c b/exec.c index 4f5df07b6a..0d30e48571 100644 --- a/exec.c +++ b/exec.c @@ -3318,7 +3318,8 @@ MemTxResult flatview_read_continue(FlatView *fv, hwad= dr addr, } else { /* RAM case */ ptr =3D qemu_ram_ptr_length(mr->ram_block, addr1, &l, false); - memcpy(buf, ptr, l); + if (ptr) + memcpy(buf, ptr, l); } =20 if (release_lock) {