From nobody Mon Feb 9 14:34:31 2026 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; 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 1526917143754658.1717716989591; Mon, 21 May 2018 08:39:03 -0700 (PDT) Received: from localhost ([::1]:51209 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fKmtm-0003vw-AE for importer@patchew.org; Mon, 21 May 2018 11:38:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34554) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fKmrj-0001rI-0F for qemu-devel@nongnu.org; Mon, 21 May 2018 11:36:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fKmrf-0005K7-Ti for qemu-devel@nongnu.org; Mon, 21 May 2018 11:36:51 -0400 Received: from zucker2.schokokeks.org ([178.63.68.90]:55995) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fKmrf-0005J7-NH for qemu-devel@nongnu.org; Mon, 21 May 2018 11:36:47 -0400 Received: from blood-stain-child.lan.ruderich.org (localhost [::1]) (AUTH: PLAIN simon@ruderich.org, TLS: TLSv1/SSLv3, 128bits, ECDHE-RSA-AES128-GCM-SHA256) by zucker.schokokeks.org with ESMTPSA; Mon, 21 May 2018 17:37:07 +0200 id 000000000000007A.000000005B02E7A3.000008E3 From: Simon Ruderich To: qemu-devel@nongnu.org Date: Mon, 21 May 2018 17:36:40 +0200 Message-Id: <1155d843cc79afa957f4365acccc00fc9a82e05a.1526916378.git.simon@ruderich.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: References: <0e59c79ddc01e195ddc59d77d9df2b95bf89b600.1523395243.git.simon@ruderich.org> In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.63.68.90 Subject: [Qemu-devel] [PATCH v3 1/5] cpus: correct coding style in qmp_memsave/qmp_pmemsave 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: Simon Ruderich Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Simon Ruderich Reviewed-by: Eric Blake --- cpus.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cpus.c b/cpus.c index d1f16296de..4b1609fe90 100644 --- a/cpus.c +++ b/cpus.c @@ -2316,8 +2316,9 @@ void qmp_memsave(int64_t addr, int64_t size, const ch= ar *filename, =20 while (size !=3D 0) { l =3D sizeof(buf); - if (l > size) + if (l > size) { l =3D size; + } if (cpu_memory_rw_debug(cpu, addr, buf, l, 0) !=3D 0) { error_setg(errp, "Invalid addr 0x%016" PRIx64 "/size %" PRId64 " specified", orig_addr, orig_size); @@ -2350,8 +2351,9 @@ void qmp_pmemsave(int64_t addr, int64_t size, const c= har *filename, =20 while (size !=3D 0) { l =3D sizeof(buf); - if (l > size) + if (l > size) { l =3D size; + } cpu_physical_memory_read(addr, buf, l); if (fwrite(buf, 1, l, f) !=3D l) { error_setg(errp, QERR_IO_ERROR); --=20 2.15.0