From nobody Sun May 19 16:58:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.46 as permitted sender) client-ip=209.85.221.46; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f46.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.46 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail(p=none dis=none) header.from=amsat.org ARC-Seal: i=1; a=rsa-sha256; t=1620231051; cv=none; d=zohomail.com; s=zohoarc; b=XJHlZNILSSwtXikbMsNKVqY0T/mxQ75sh+Fs2y5v7v5Js97ezoizGyelzkWmvCWIK+ljcwHwY/mU209QqzPfEyXVd9yZGSRglpOhbZ3WicwK1wsPcLBYZR7830S41SP30cSNV5WAUuihyqwF34fmb+B+vS7fSKLuh6rYt725BvU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620231051; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Sender:Subject:To; bh=YKZnUdVXT3DhhQC6sc2aNoe+FBTMI3ffJAjvFbk8MDo=; b=EnHGLlsyNW9P/IxZnnkY3vk98SPSE3UsVnaLPuYTjIVKx0qhIzheZwyzt/bhzNOEkNa4uhXXVPkIYpr9NM0WetDUP4Qv3W9ejjAOosNYhslu66GS/a+vORlv9KDAe5kEVbx0pEeR0bzKm6WwTLvn1NcXwqh6vf5uCXYSMmeuXrc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.46 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by mx.zohomail.com with SMTPS id 1620231051050137.697129545061; Wed, 5 May 2021 09:10:51 -0700 (PDT) Received: by mail-wr1-f46.google.com with SMTP id n2so2490962wrm.0 for ; Wed, 05 May 2021 09:10:50 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (astrasbourg-653-1-188-220.w90-13.abo.wanadoo.fr. [90.13.127.220]) by smtp.gmail.com with ESMTPSA id i12sm12427816wry.57.2021.05.05.09.10.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 May 2021 09:10:48 -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:mime-version :content-transfer-encoding; bh=YKZnUdVXT3DhhQC6sc2aNoe+FBTMI3ffJAjvFbk8MDo=; b=U2qhriwIVPuOdgBO/n0qXF1/HH/Dqbq/yvkpxM1SWmsDfez4HdjgufFebnp5IAOgOa otYbIEnKZOU2UAyv33JiVkP026w8wR0/xIeEht1iO0LfDgJjvI8fI1FlR/Xi1o7OIpI0 8RHJvF94nwONNWZ/EFxG/Ob4VGLvvqg7azGsz5AsXo3ZwjqD1dRWHUSeyDJsMIiRNGOv X/qPjBB479JjTBKPLaXGOOYHgFJ6ZkgTrRjGlTooMeH0UWQgtGAAPeM97puhOZ2KNU6i Ni/BcBtqvYej3HRIyBOGVDeEjf/XU3Z678+uQgiwiIF4p7PC6npMKWy3PwrfyRqBOxAW NgbQ== 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 :mime-version:content-transfer-encoding; bh=YKZnUdVXT3DhhQC6sc2aNoe+FBTMI3ffJAjvFbk8MDo=; b=lbWPqpxaNh+W8uX6/mrXjzisdeeeL/p2EcvojQ2d2VmXBJkRn3llCzFVwoE6ei1Vbr KB0SGvDfHPLGuxTnfXcsyxeD9KU8ugrogZzyvXzvZwbig+8ONfKB9rA9qyKrX3j+nTpn vOdSnrOKtoXK38t0JOGhKkMw0w2FN4hDknhOa0z91+Xd/zlb8w4R0skRbQLbTdMxxcof dcQr9Y+hnr2bX+J8ivqzJif5GC++RJBr1uWxVewhACjAgh/4y8ZliZ/gr8IBJjHjna90 uhXJInK1J8ma5iY5leN4MQKhEV84O0QaZfD0+4Xu3pjgiof48hmERmVIchzTrTRINErR ad5g== X-Gm-Message-State: AOAM530PHEmFzMEXSBiGZT0BmsaMxuP3GosY9s2Db9s+onlFOwhsCTZp 1YrSaqwCENqjacgOyNhiAx0= X-Google-Smtp-Source: ABdhPJxXrVh49uQyECv9VaNrl4Pd3uM+EaYLZRwirRyO5kWcCX1w479WqzGMxWHDildm2bz3EU2Hkw== X-Received: by 2002:a05:6000:1811:: with SMTP id m17mr17920136wrh.318.1620231048855; Wed, 05 May 2021 09:10:48 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Yoshinori Sato , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH] target/sh4: Return error if CPUClass::get_phys_page_debug() fails Date: Wed, 5 May 2021 18:10:46 +0200 Message-Id: <20210505161046.1397608-1-f4bug@amsat.org> X-Mailer: git-send-email 2.26.3 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) If the get_physical_address() call fails, the SH4 get_phys_page_debug() handler returns an uninitialized address. Instead return -1, which correspond to "no page found" (see cpu_get_phys_page_debug() doc string). This fixes a warning emitted when building with CFLAGS=3D-O3 (using GCC 10.2.1 20201125): target/sh4/helper.c: In function =E2=80=98superh_cpu_get_phys_page_debug= =E2=80=99: target/sh4/helper.c:446:12: warning: =E2=80=98physical=E2=80=99 may be us= ed uninitialized in this function [-Wmaybe-uninitialized] 446 | return physical; | ^~~~~~~~ Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Yoshinori Sato --- target/sh4/helper.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/target/sh4/helper.c b/target/sh4/helper.c index bd8e034f174..2d622081e85 100644 --- a/target/sh4/helper.c +++ b/target/sh4/helper.c @@ -441,9 +441,12 @@ hwaddr superh_cpu_get_phys_page_debug(CPUState *cs, va= ddr addr) target_ulong physical; int prot; =20 - get_physical_address(&cpu->env, &physical, &prot, addr, MMU_DATA_LOAD); + if (get_physical_address(&cpu->env, &physical, &prot, addr, MMU_DATA_L= OAD) + =3D=3D MMU_OK) { + return physical; + } =20 - return physical; + return -1; } =20 void cpu_load_tlb(CPUSH4State * env) --=20 2.26.3