From nobody Fri Nov 14 19:24:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=amsat.org ARC-Seal: i=1; a=rsa-sha256; t=1589817288; cv=none; d=zohomail.com; s=zohoarc; b=n7lWU1mCsaE4dGYyuR3MVlujlperd6umM+lxNEw+gr9HRSqp2pAm9XY2IAPKKCf+x9ftPNQdcEfWx7rBxJcEBvmdjQqEf0irpFmDtaNEzLiH2YGefTO2e+iDtWeMxeZDKT3M4Fsxq5aqcK9qiD2R4uh1WCqU0Yn2+mnc2MUQ/p8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589817288; 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; bh=WPXev8+IwguGZ8+5BAOfNLRRppnJCLUsP59v0te4Ye0=; b=Z0pRBhtDZn4WbVouy8ilTxRB6JUcdLLcf6YFlAO/jCK3VjJwiQ5yFmJxbFd2aDuSR2aQIOYCKRtRqXpyyBCqnycWvWjEq5hZbBFjJal3FzroiEDgBopWLjQssiWNvcC/tAnox1usZZ8QhTwKrk9jBdGxzSHF4lYHJecq22A0PKw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail 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 1589817288307607.3745598818128; Mon, 18 May 2020 08:54:48 -0700 (PDT) Received: from localhost ([::1]:38576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jai6I-0005OV-T6 for importer@patchew.org; Mon, 18 May 2020 11:54:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52608) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jai4q-00034C-A2; Mon, 18 May 2020 11:53:16 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:53829) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jai4p-00005F-F0; Mon, 18 May 2020 11:53:15 -0400 Received: by mail-wm1-x344.google.com with SMTP id k12so20719wmj.3; Mon, 18 May 2020 08:53:13 -0700 (PDT) Received: from x1w.redhat.com (17.red-88-21-202.staticip.rima-tde.net. [88.21.202.17]) by smtp.gmail.com with ESMTPSA id 7sm17647462wra.50.2020.05.18.08.53.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 08:53:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WPXev8+IwguGZ8+5BAOfNLRRppnJCLUsP59v0te4Ye0=; b=GBNszTaaBEoLSKErf6Onp2KjlP2lFLTKTV4hGUyCnOMb7cgyVRocIEAPY8J3mCvb8Z vCLXgoCH3exBUN+Yjhpatnjh2Fa5e1ewx1l3wOj4/SrE8ApiJzbGKFBw2Fk0/ADaP63I bKZiVONe3xodATG6yQv3Mm0gvaazMRU/T7zFjIayETtffjPtUlcgjkmY4YHXL9KjPjUG 8NwSfTHR05vPqYuItDiHZDYMDcHpYzEeXbnyBK2nu5eOha5ZGzFFsSAJhOruzapfQKPz 24y236VkwWStBZHxoh2/GZN2xjsFUq8IM0KPfG/DLwlqaj2FIlz5EX4CG6JWCxKql8/O rSgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=WPXev8+IwguGZ8+5BAOfNLRRppnJCLUsP59v0te4Ye0=; b=g6+5pdi0m1zEr4EJRrxwlYmdopVaJ+YGots8QTbGYRScwSsJk8FsejKog/w1Qac/K4 K8SrYahudcqFi0LhBPyQqxp3wwvggLis5HcTZLjAr1NHBxxhWIcEFii7zaxKwowWDegJ o1kWiQMly2qYQ4hhzEDVzYsb85edhapm5haP4RaKUHI2lO3cw2D3s6OD07+9sYzJnSkH exVw8lfbl1J2WcsBHiayZ1Mvq+ctAlEq4JS9LUiEARElaD8sn3HSesk2CgNxlSL6rzrw ROSh1jtZ+03JKPreKYjq+2SRmIANzJdFM9+HkZLuqOnt5Wc7U2Ga4oud9CuxKCSlfXvc 7bJQ== X-Gm-Message-State: AOAM533ctikKRfSxJgk991EjAjFOamYkTAxv/drQX/EigPBvk8CF2E1F AmzDh0BZKXXuY6stQWrjRIxYI4t8KZQ= X-Google-Smtp-Source: ABdhPJzmaRkrF6Y1/DbPQKadJiZELqBF4agH6qtXZaXxgNHiLJ/vIraP/94NcfVxkbXCvsz/IBZspw== X-Received: by 2002:a7b:c8d4:: with SMTP id f20mr60869wml.72.1589817192193; Mon, 18 May 2020 08:53:12 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 2/7] exec: Propagate cpu_memory_rw_debug() error Date: Mon, 18 May 2020 17:53:03 +0200 Message-Id: <20200518155308.15851-3-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200518155308.15851-1-f4bug@amsat.org> References: <20200518155308.15851-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2a00:1450:4864:20::344; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x344.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: Peter Maydell , kvm@vger.kernel.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Do not ignore the MemTxResult error type returned by the address_space_rw() API. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/exec/cpu-all.h | 1 + exec.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index d14374bdd4..fb4e8a8e29 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -413,6 +413,7 @@ void dump_exec_info(void); void dump_opcount_info(void); #endif /* !CONFIG_USER_ONLY */ =20 +/* Returns: 0 on success, -1 on error */ int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr, void *ptr, target_ulong len, bool is_write); =20 diff --git a/exec.c b/exec.c index 877b51cc5c..ae5a6944ef 100644 --- a/exec.c +++ b/exec.c @@ -3769,6 +3769,7 @@ int cpu_memory_rw_debug(CPUState *cpu, target_ulong a= ddr, while (len > 0) { int asidx; MemTxAttrs attrs; + MemTxResult res; =20 page =3D addr & TARGET_PAGE_MASK; phys_addr =3D cpu_get_phys_page_attrs_debug(cpu, page, &attrs); @@ -3781,11 +3782,14 @@ int cpu_memory_rw_debug(CPUState *cpu, target_ulong= addr, l =3D len; phys_addr +=3D (addr & ~TARGET_PAGE_MASK); if (is_write) { - address_space_write_rom(cpu->cpu_ases[asidx].as, phys_addr, - attrs, buf, l); + res =3D address_space_write_rom(cpu->cpu_ases[asidx].as, phys_= addr, + attrs, buf, l); } else { - address_space_read(cpu->cpu_ases[asidx].as, phys_addr, attrs, = buf, - l); + res =3D address_space_read(cpu->cpu_ases[asidx].as, phys_addr, + attrs, buf, l); + } + if (res !=3D MEMTX_OK) { + return -1; } len -=3D l; buf +=3D l; --=20 2.21.3