From nobody Sat May 30 17:44:35 2026 Delivered-To: importer@patchew.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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1778578820; cv=none; d=zohomail.com; s=zohoarc; b=bOu5b8lTReGpyFZoTn1rnN3zNwGsx+B2cGf2fXUCPjEymo8dXa+qQ9+9DY71RyIOO0gCQQtXOsIiJmlk92EDftN0UczIuAtYoitMdkDyTk1GOkyqIDylFi8bnCMPOLxAtwLAiszKIoZbhlVPfjXl8XIavzXJaQPt6RFZv5d/jXw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778578820; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=2x1gTXoUQl7esPZgHPEC5mc0dO4FVec/dPz764aIyC0=; b=FSrIIBwT4Yr2Ti0Zs1IveZ4/8SbU44vyOQWNoEl64s8sT+mJMk7Bh1AFrFC25PwVuR3kZpHDl28pJjQyWRL7oxV7HrWshYVkpjkHae21TwSgWvLf8NCIl0SwuoQwEA2TGZ8/UL7ZRBgZmLkeXzrzio+jXopbwaMzEe/QYiMAz5c= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1778578820690919.1742667427127; Tue, 12 May 2026 02:40:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wMjZy-0008JZ-Vu; Tue, 12 May 2026 05:39:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wMjZw-0008IS-2d for qemu-devel@nongnu.org; Tue, 12 May 2026 05:39:04 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wMjZt-0004nS-6r for qemu-devel@nongnu.org; Tue, 12 May 2026 05:39:03 -0400 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-43d7645adbdso2860560f8f.1 for ; Tue, 12 May 2026 02:39:00 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4548e6a6a64sm32805208f8f.6.2026.05.12.02.38.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 May 2026 02:38:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1778578739; x=1779183539; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=2x1gTXoUQl7esPZgHPEC5mc0dO4FVec/dPz764aIyC0=; b=lpEhRVBLsSgidoY92X0KgDsSA+bhZ7SOsxknDzRrQHdVRqQq3ivBDWG/OiCFQMNWeI AJkrrwenR2AZQc+/tNxRt3cNcaiKNoAe5EoFx6V8109n3dNMnyWrUy+WiOWyh2ZrJ+4k GEgG2fuecJsaSc0kPulLOhy7kIOBlfMIwmso3P/1A+l3URtB6CIfQMjYrpv3pbxXyHE5 MBt3K2dUeT4zAF96K6TZnvkkeQT493F1kcpHeRbt2Pn3OSLYGxPH7vGiuUWDAC2NkHT5 iIEHf2pySPXmASSxilpTINU/nGXkZ5p2W7GEDJwSPPCWQnaVWNH6qYrzrVfYx5cdA6TQ SJ+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778578739; x=1779183539; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=2x1gTXoUQl7esPZgHPEC5mc0dO4FVec/dPz764aIyC0=; b=YeGJRY32x5XEN/S8XyFJu8vmhMsBa0sUi6mV9CYS/7G3xDH66q6nU1SzqLWcPg9XjZ VX7EvNhp2NPizTzzo8JaoBj3ge8+ebHuCu3sPgMN9dw65Uci4ld7jefNQRwbd0obi+bp E4pp7SzkhbvycJzmsDGskfOotqbwmAG7eN/y5Yx4BC3C27bt7BhGVD0FaBdoDXJQwtYv 84peVeh8Hc9TTvG7NgpLVsHWWSkvIBVn2oFk1Kk1whl6qPJEG8LH9/f5KNM3ZtCcnVZV OH8KUPod8DHIyEHAyBP+z5vJbFZluMU4FNnDbhqXW9yX5/ihMxvKmyVQ6Ys9XyEeDa4y xPjg== X-Forwarded-Encrypted: i=1; AFNElJ+/ryzSBLR9kEUme9h+26wFXQl/gyRxuqnB/R37ZNXQKr5SXObNmLtpwP+RuUH43ZE4aSVO6jY989Li@nongnu.org X-Gm-Message-State: AOJu0YwTH9OJNf0YAHWoGExuK7Qozy+/CDRpwpv37BfYCnY+5tX5K60F DovyoVdEAbl2j4GMdJ43az2i1e/1iT9SuZLq5NS7mLGzR3hL8kNXId1+OV5vHBMwGlA= X-Gm-Gg: Acq92OH+PIJpnFzcBSX/TBBZIZTAaGZOU9ll4FWKXaeizoSIhOHWkR7WK1M4rGf535h 4aG4S2ziW7QtsWNUcIFPkgT+l0u/MR/whxH+Aj0qIA41drCT7yWlqJEJ6PupyVRyP+FKDEd3r1j 9qNPNfROvDl7FgXN2N5X6D2UiAYoh/750h4KJwxXhOJ3TJFpDS1GqKOW8AMl2tXPVm/2HYwGNLj iZt5peVl54ScU5bnWjnBEZSGqD2sFIxlB5HNY1ZZCI9xRbYsH5OT0wocELxTWCIhHo7vjM4lYC6 S5oVWwHCvzGGhKPdDQ0nTloobSpthoQHlkX0rugFW3SHfQ876iyi7CQ6kTeEPbQ68o7ChCovEtC gTMPuxLqESyf+n0MPFtcy9vXs3iflg1wsyPIuB4hFs6ehkk5z5Qw3dSo+XoRbAO8uONZ5qmyCTm 1NB9yE2ekXp8KH5NxEzyVNm/8uT+TEwYVNT7qY1P/Sb3Jfmr3sCPFdUEzBKPNQ1Xal+h6wyr8TH 2WGqGipNH8oPCBEMHr1m55f+lVntFY= X-Received: by 2002:a05:6000:1acc:b0:43d:7883:87ce with SMTP id ffacd0b85a97d-45b1441c919mr3176486f8f.34.1778578739359; Tue, 12 May 2026 02:38:59 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 1/4] target/arm: GICv5 cpuif: Fix overflow in left shift Date: Tue, 12 May 2026 10:38:53 +0100 Message-ID: <20260512093856.3197700-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260512093856.3197700-1-peter.maydell@linaro.org> References: <20260512093856.3197700-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1778578822350158500 Content-Type: text/plain; charset="utf-8" Coverity points out that we forgot the "ULL" suffix when shifting 1 right by a bitcount in various places, so for bit counts above 31 we end up shifting off the end of the word. Fix the three problems Coverity noticed and one more of the same kind that it didn't. CID: 1659588, 1659591, 1659559 Fixes: ce245ac6957 ("target/arm: GICv5 cpuif: Calculate the highest priorit= y PPI") Fixes: 3f79212abae ("target/arm: GICv5 cpuif: Implement GICR CDIA command") Fixes: 49f4c98648c ("target/arm: GICv5 cpuif: Implement GIC CDDI") Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- target/arm/tcg/gicv5-cpuif.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/arm/tcg/gicv5-cpuif.c b/target/arm/tcg/gicv5-cpuif.c index bc44a7fc11..98238ada19 100644 --- a/target/arm/tcg/gicv5-cpuif.c +++ b/target/arm/tcg/gicv5-cpuif.c @@ -275,7 +275,7 @@ static void gic_recalc_ppi_hppi(CPUARMState *env) int ppi; int bit =3D ctz64(en_pend_nact); =20 - en_pend_nact &=3D ~(1 << bit); + en_pend_nact &=3D ~(1ULL << bit); =20 ppi =3D i * 64 + bit; prio =3D extract64(env->gicv5_cpuif.ppi_priority[ppi / 8], @@ -631,7 +631,7 @@ static uint64_t gicr_cdia_read(CPUARMState *env, const = ARMCPRegInfo *ri) * gicv5_activate() cause a re-evaluation of HPPIs they use the * right (new) running priority. */ - env->gicv5_cpuif.icc_apr[domain] |=3D (1 << hppi.prio); + env->gicv5_cpuif.icc_apr[domain] |=3D (1ULL << hppi.prio); switch (type) { case GICV5_PPI: { @@ -639,7 +639,7 @@ static uint64_t gicr_cdia_read(CPUARMState *env, const = ARMCPRegInfo *ri) =20 assert(id < GICV5_NUM_PPIS); ppireg =3D id / 64; - ppibit =3D 1 << (id % 64); + ppibit =3D 1ULL << (id % 64); =20 env->gicv5_cpuif.ppi_active[ppireg] |=3D ppibit; if (!(env->gicv5_cpuif.ppi_hm[ppireg] & ppibit)) { @@ -707,7 +707,7 @@ static void gic_cddi_write(CPUARMState *env, const ARMC= PRegInfo *ri, } =20 ppireg =3D id / 64; - ppibit =3D 1 << (id % 64); + ppibit =3D 1ULL << (id % 64); =20 env->gicv5_cpuif.ppi_active[ppireg] &=3D ~ppibit; gic_recalc_ppi_hppi(env); --=20 2.43.0 From nobody Sat May 30 17:44:35 2026 Delivered-To: importer@patchew.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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1778578787; cv=none; d=zohomail.com; s=zohoarc; b=ZamcNpm29tcN9413qj2WDp0GcxzpIpY1CK9Wu3wt7XgqWlJW+iezWReu35QXog42ipNe35SeixzpeegBSF8M7x7YTZyU2Z6ISOs8j5GpNdNhdgRVJNFhyccRKwNEodjMzMOPbPbYFkS+DHdHIXYCW9gAy8OwqUvH7GT3q7nfSdM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778578787; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=0KudvLHguH9tRc9Lgq+2mRst/v85r9PXfkOE55p48us=; b=F7DVY7Bd/oxSfVBSBinUQYclsErYE2Ubkk8LrDqsmFiP/hN/tablr9K3cA98kWD9NP8pYgKTRhvYWoTSRE6OQVuQbV65Pp2pVjwPnQKqQE07sB85A+bXhw1pq8L3Qe6pBI3LKw0XtxjJeShfoNCCi5RzeK6niwDT1X9oiLWaU5I= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1778578787020367.69012210017604; Tue, 12 May 2026 02:39:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wMja1-0008LB-1W; Tue, 12 May 2026 05:39:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wMjZw-0008Ia-6a for qemu-devel@nongnu.org; Tue, 12 May 2026 05:39:05 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wMjZu-0004nt-6Y for qemu-devel@nongnu.org; Tue, 12 May 2026 05:39:03 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-45297094718so4225726f8f.3 for ; Tue, 12 May 2026 02:39:01 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4548e6a6a64sm32805208f8f.6.2026.05.12.02.38.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 May 2026 02:38:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1778578740; x=1779183540; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=0KudvLHguH9tRc9Lgq+2mRst/v85r9PXfkOE55p48us=; b=oAAH7RPpQBnPLJxL8z8k+3VOC7Yzxym1W9CWMDWkis0WukHLwIjZ+t0jeXi4Kld+MX 2qaT3bQfNDUFugW4k6J+t/2LtC1PPW89/Jp2ubDuYCcm8fv6cL7zpRzHhS8NccAh8r8g Gah5ciMxdRODR08eaNCmyGOX07RwDPYObLDryKYwY7PxJT/UcnJZOI3s4+R2fMo55T0C dVA6OmYHwBEHpDVy20yn0MZkSBZBtqW2+qzISAAAbjS7gnFUwKViSQRSkvVnUpdOKiiv 6/1C+BmPWpUNdhTdCCY5n3YdXWFlsuglO93uXpELKBKXNXGGMfPoixRXNckOnthMFV0I gNmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778578740; x=1779183540; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=0KudvLHguH9tRc9Lgq+2mRst/v85r9PXfkOE55p48us=; b=B4D2O8uYSN31oABuBH8a14dtnphQaZqtFNJsc7lv68q/txNG2Q62nS/2Qy3bO4NKto PFmGD+UtN0pwMfJkfZ/he3IqyAzySJxhvGERCAB9Rt193t9Cnt/XUfBlwb8yRQbU1K5T ECk8kYDhF6NQnyVgVC++omWAv27SJHanyECRvmWuEZrd924Dy5GxoVRzkyAVNviMkILs jtACa5FGEGPrNqnVFtGAR29eJwfQE5m5CS0ppD9UnRSmMH8U/Qf5LmGi1x4x3kdTyxs+ EamD8HHKl35uPBdFnAbueXVCG09xX7rHmJgKByMompgrpcmqQ6j5XQ7o8MU3+sGOk7Fa ATsg== X-Forwarded-Encrypted: i=1; AFNElJ9hiIP9ErDKvu6s+eMJzs14vbFDOSY6rnLsWiPRbkXl4IGDJ1+zRfPEm9Pck7JWweiZnKI6kURhN8a6@nongnu.org X-Gm-Message-State: AOJu0YwQdPwZzOV4WwAjC7K/cfo0ZINWaV1Fvp8Jp3+Oj9cXi4uwHuKO 6QVICaLhwW2jepn5nulHYcfLaIT//WFYTuFvkwIarUqjjRFb+Ov4d9+g380rTSDuy7I= X-Gm-Gg: Acq92OHQZxfUSPWBagoF3gRw2ZkZL+pyXb/E07bjGjRodFbKWOYmlKKICLeeXTnp8MS nT0FBPpkt7AdnJwWP1Uf6SA+1L8MmsnvE3uSSkokqPzDmEb3iUpFtIS355A1iqZJxJzxiaUx5X5 Q0ATrrC+CfxWSlviEVYejMvF0GA2s6PMzOQgQbB2g2I0bHTt58zfMcmlfSJn+Ulje9akXIKc31/ Rnc6dWbQt5b8Z7ONqFtUzZyJ9T53D+XhpiRXtb385tvbSXo+fMFwVfFifJtwH7znyK2+7QODT1C j18fO0RKgEDexMWVOhuUbNKVQ5OKkLzEw37u5acknqiea2ditCqdOpBu3PTTTEvMYzrOEpcn4YK hdzpGaWRi6rxYi4ij0dNhmI+5RnrxPj/jRyy+iK1TRCmpekqIIohL8MARyMf8qzXDsjXUWdhqm7 BMSacmQcB02dfy6Vu6Z1wP5kJIW/jWTYGTAbm0kk+AYbogRLjWYxBLFR8xVqqyIOY1IAoNQWP8z 64/VmNf/MbIhxxVHjjglDpgAYXOdag= X-Received: by 2002:a5d:5850:0:b0:43f:e934:50ac with SMTP id ffacd0b85a97d-45b115c7e50mr3034894f8f.7.1778578740514; Tue, 12 May 2026 02:39:00 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 2/4] target/arm: GICv5 cpuif: Don't set HPPIV bit in GICv5PendingIrq::intid Date: Tue, 12 May 2026 10:38:54 +0100 Message-ID: <20260512093856.3197700-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260512093856.3197700-1-peter.maydell@linaro.org> References: <20260512093856.3197700-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1778578790767158500 Content-Type: text/plain; charset="utf-8" In gic_hppi() we return the current highest priority pending interrupt in a GICv5PendingIrq struct. We try to set up the intid field of that struct to be the form that is used by the ICC_HPPIR register, which has a "valid" bit in bit 33. Unfortunately the GICv5PendingIrq defines the intid field as a uint32_t, so Coverity points out that the bit doesn't actually fit. Move the handling of the valid bit to the callsite, and make this function report "no pending interrupt" with GICv5PendingIrq::prio =3D=3D PRIO_IDLE, consistently with how we use this struct in other places. CID: 1659594 Fixes: 9edad4ff3 ("target/arm: GICv5 cpuif: Implement ICC_HPPIR_EL1") Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/intc/arm_gicv5_types.h | 2 ++ target/arm/tcg/gicv5-cpuif.c | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/include/hw/intc/arm_gicv5_types.h b/include/hw/intc/arm_gicv5_= types.h index eaed42f49f..de4f78a149 100644 --- a/include/hw/intc/arm_gicv5_types.h +++ b/include/hw/intc/arm_gicv5_types.h @@ -97,6 +97,8 @@ typedef enum GICv5TriggerMode { * * In this struct the intid includes the interrupt type in bits * [31:29] (i.e. it is in the form defined by R_TJPHS). + * + * "No pending interrupt" is represented by @prio =3D=3D PRIO_IDLE. */ typedef struct GICv5PendingIrq { uint32_t intid; diff --git a/target/arm/tcg/gicv5-cpuif.c b/target/arm/tcg/gicv5-cpuif.c index 98238ada19..dd2f696511 100644 --- a/target/arm/tcg/gicv5-cpuif.c +++ b/target/arm/tcg/gicv5-cpuif.c @@ -129,10 +129,9 @@ static GICv5PendingIrq gic_hppi(CPUARMState *env, GICv= 5Domain domain) { /* * Return the current highest priority pending interrupt for the - * specified domain, if it has sufficient priority to preempt. The - * intid field of the return value will be in the format of the - * ICC_HPPIR register (and will be zero if and only if there is no - * interrupt that can preempt). + * specified domain, if it has sufficient priority to preempt. + * If there is no interrupt that can preempt we signal this by + * returning a struct with prio =3D=3D PRIO_IDLE. */ =20 GICv5Common *gic =3D gicv5_get_gic(env); @@ -166,7 +165,6 @@ static GICv5PendingIrq gic_hppi(CPUARMState *env, GICv5= Domain domain) best.prio >=3D gic_running_prio(env, domain)) { return (GICv5PendingIrq) { .intid =3D 0, .prio =3D PRIO_IDLE }; } - best.intid |=3D R_ICC_HPPIR_EL1_HPPIV_MASK; return best; } =20 @@ -575,7 +573,12 @@ static uint64_t gic_icc_hppir_el1_read(CPUARMState *en= v, const ARMCPRegInfo *ri) { GICv5Domain domain =3D gicv5_logical_domain(env); GICv5PendingIrq hppi =3D gic_hppi(env, domain); - return hppi.intid; + + if (hppi.prio =3D=3D PRIO_IDLE) { + /* No valid interrupt */ + return 0; + } + return hppi.intid | R_ICC_HPPIR_EL1_HPPIV_MASK; } =20 static bool gic_hppi_is_nmi(CPUARMState *env, GICv5PendingIrq hppi, @@ -602,13 +605,12 @@ static uint64_t gicr_cdia_read(CPUARMState *env, cons= t ARMCPRegInfo *ri) =20 bool cdnmia =3D ri->opc2 =3D=3D 1; =20 - if (!hppi.intid) { + if (hppi.prio =3D=3D PRIO_IDLE) { /* No interrupt available to acknowledge */ trace_gicv5_gicr_cdia_fail(domain, "no available interrupt to acknowledge"= ); return 0; } - assert(hppi.prio !=3D PRIO_IDLE); =20 if (gic_hppi_is_nmi(env, hppi, domain) !=3D cdnmia) { /* GICR CDIA only acknowledges non-NMI; GICR CDNMIA only NMI */ --=20 2.43.0 From nobody Sat May 30 17:44:35 2026 Delivered-To: importer@patchew.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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1778578827; cv=none; d=zohomail.com; s=zohoarc; b=gq3Sivj6KFiLNBoHBwwS6oOL6Ea2uI92hXrC9bGwqPemzhBVDeNV8AsX2cJcswiKl3yQTQIOQ0WSDObitwtFNMzFldb1ZR62peTd8ZZNT4JfWDDKAXw8/vAlTMYmfahkZJbyVEfFKp5SWJP0Nfo9tsH+KrIYFiXLdrBeyccaBe0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778578827; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=mMiEiZELjpk4cjktkRPxm3pXmOfuJINIuLF6ke/BYnY=; b=J4GsHX8EozA3BHmrtzaoxsqU1eIlmUJo+QvS1N9B1XHkv8HbdSR3P+Uvbxj+I3OuPwsqwTduzfrxV7x9RTImzaCk4wl1warqYCvu2WPRpx+2zwjBktBhYaOB7lKxImmPP1D3dQG/dMegf4YmLYnCZdqI7XoQuREaPgyFqY8OWDI= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1778578827062718.8427582327537; Tue, 12 May 2026 02:40:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wMjZz-0008K3-7z; Tue, 12 May 2026 05:39:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wMjZx-0008J1-9O for qemu-devel@nongnu.org; Tue, 12 May 2026 05:39:05 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wMjZv-0004oI-51 for qemu-devel@nongnu.org; Tue, 12 May 2026 05:39:04 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-449de065cb3so4804646f8f.2 for ; Tue, 12 May 2026 02:39:02 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4548e6a6a64sm32805208f8f.6.2026.05.12.02.39.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 May 2026 02:39:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1778578741; x=1779183541; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=mMiEiZELjpk4cjktkRPxm3pXmOfuJINIuLF6ke/BYnY=; b=Ww6nj7r+t875hB1Md7FTtM8s6SFSrCKPQEELMSHmSudUj6y2sKyq5SaYFQQK+ge+yJ jYS3g2821zIOnDRWgO7aKU3YZLY+Rj1L3T2yZfiHXPfIpZ3BSUm7FjpE5hFTwovxeYXs E86J8SeNa2qW4pOGqfhsHvl0SgyjVFZwTATjz/7SIsczGtUJHzWx0teiV067BbrpAr5Z SO41G04MWdXC04bPHzCSXvkDF8crIhhwAWckNTnZHoZFg+LfUiD/5S7IuYmDhTHL4REs XM90O5+32Xa1SeelmArQjhJrOcaj2UiEnS0XgjjlBPD13BowlV1McGgST7Vc6eE8QX7W jJgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778578741; x=1779183541; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=mMiEiZELjpk4cjktkRPxm3pXmOfuJINIuLF6ke/BYnY=; b=YV7/VItNTO3m51BVTMUS+DWF+A4CPfuDM/oz8GtuNBPfO0stQ13IkHHa7QBemGhL6R hLFTPRSg1bIMiPRXdR8ZVeH3LEBOjjkJ/En8C0TKO7Jc/FXqGAcuMaRE+CDB9FoahSwK h8RP4W7jj/XVRFzSDGxBOQWNTvWVpzFjEwP93HHHj/VSf3a+qaVzTkCPqniHeTCt3kOv 0JBUDqDmSADlU1sNAJn1B12KCqJ509w3duO+YKn2Urt0vWG2b0pHp9dZUhm6dX/xP7qq 8nMPl05BtnwkjeWpO2U7m6dvGgiV45shDThm7um2ZZrzwx3fgmG9OUJxp5dCSX4obo22 nD+Q== X-Forwarded-Encrypted: i=1; AFNElJ9QPDgSKxC1xQkLXtjX4kg043kRLSh8GKLRWrac4/kLNCctfyjKtIsCMlYtQ3GR46VoN+Y4xpqH7vja@nongnu.org X-Gm-Message-State: AOJu0YySzdEhntDuGVPrW/vsqHPuWB8MrZJn+dlJsnouD3lSVxaUrEUm 4Hp3ARD6S10GcF9wuvC44zj7Qr4zBYs1vdZg8aFrl7/rfxNJqi0XImlgYTJNhZ86yEs= X-Gm-Gg: Acq92OGtVeBuWK3ypqrFJahF+ZzDYEK4sYiXjRYLwS5jnQrTQzNUeTTvDJTM7+gtCFO 1NRgsSavNa5AQT5eyqWu+JtNpDm+VttsPBN6rLZSPaY/dSGLFs7u2PD2QYhJC1fqxypDM3hd8J4 +AalRfY+UECd2TBGJca9o7bQ//i56WtPzMGX7X2mlH2XY+FTuuUoRtL02lmXCkODhmdj2Tkq5QG 7dHxb1URgz+6iJkuGnS2SmPkD64ctHlgJh0+PIA7972m4AfNBGvjcm2le7bWkyDPw15oV+e+7ve iv602SpcSx1xf93s/t8vGmpWzHC79WvefOwBKOT2NkL0FnsfG7/nJAKaUyPoKcdSyR8U+jD2EUA ZkISzYhbp6RUYXCi61DowmlNZ3ljnJaRm8T5CvvnNNCV424oMBxNmpJeQNpgdA2wnA6U75PScRG roKzh2Wjivmvh4VN+cm7+ewQU6uRpbLvdHYaUBMI5nNKlw/D3A5lthtDT9NnyhaIe0h0+rH4ORT gGO32ykFMb6zXDw+KBhwWI8uDm2drw= X-Received: by 2002:a05:6000:1868:b0:44f:da54:da6c with SMTP id ffacd0b85a97d-4515ce1c84emr47414188f8f.26.1778578741504; Tue, 12 May 2026 02:39:01 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 3/4] hw/intc/arm_gicv5: Avoid NULL dereference in trace line Date: Tue, 12 May 2026 10:38:55 +0100 Message-ID: <20260512093856.3197700-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260512093856.3197700-1-peter.maydell@linaro.org> References: <20260512093856.3197700-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1778578829733154100 Content-Type: text/plain; charset="utf-8" In the handling of writes to the IRS_SPI_RESAMPLER register, we call a trace function, passing it information about the SPI being resampled. However, spi could be NULL if the guest tried to resample a nonexistent SPI or one configured for a different domain. Move the trace statement inside the "if (spi)" block, as it's only interesting trace if we actually did a resample and potentially changed the state of the SPI. CID: 1959593 Fixes: 33185e1d64e ("hw/intc/arm_gicv5: Update SPI state for CLEAR/SET even= ts") Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- hw/intc/arm_gicv5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/intc/arm_gicv5.c b/hw/intc/arm_gicv5.c index 493d664625..7ad274e369 100644 --- a/hw/intc/arm_gicv5.c +++ b/hw/intc/arm_gicv5.c @@ -1643,8 +1643,8 @@ static bool config_writel(GICv5 *s, GICv5Domain domai= n, hwaddr offset, if (spi) { spi_sample(spi); irs_recalc_hppi(s, spi->domain, spi->iaffid); + trace_gicv5_spi_state(id, spi->level, spi->pending, spi->activ= e); } - trace_gicv5_spi_state(id, spi->level, spi->pending, spi->active); return true; } case A_IRS_CR0: --=20 2.43.0 From nobody Sat May 30 17:44:35 2026 Delivered-To: importer@patchew.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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1778578813; cv=none; d=zohomail.com; s=zohoarc; b=k/RVC43WlYPL/AO5EJJoIvRjxGgx/00UrHI7Yra713KCZOGIEXLCRbZlc2HL/j+KKuI/bwq1h8TirVTJfN0ep4L6U0o+SNU8GQH8OOoG0odxLu3BzhDXuH3Ea/K2yMJ16Rei8n3KODpAdaAjJX4lFhURQ7IcaquzqL+Fcz3CBMQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778578813; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=OnY/BWGcNqO9qjtPpU5g66srFDOxGnE7YQ7EIiD8zhE=; b=KsuVX5xbYO//jGcGDUlLZdaN81PYw4uDIX2S7ayR/ZImUX1/twR0Du9D2e4keef9E1JruWlz4ksxsrk0yHdz+TBU740RB5msnAgfPoyZhpccYbPIW5DzNv4On5WB2NX8xtVGLXIrIPFDY0aTWJo1kdrCB7JSYDz6b22U+bpl3Ts= 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) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1778578813757678.8672027674837; Tue, 12 May 2026 02:40:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wMja1-0008M3-JS; Tue, 12 May 2026 05:39:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wMjZz-0008K9-CD for qemu-devel@nongnu.org; Tue, 12 May 2026 05:39:07 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wMjZw-0004oj-Ae for qemu-devel@nongnu.org; Tue, 12 May 2026 05:39:06 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-488b150559bso41104505e9.1 for ; Tue, 12 May 2026 02:39:03 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4548e6a6a64sm32805208f8f.6.2026.05.12.02.39.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 May 2026 02:39:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1778578742; x=1779183542; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=OnY/BWGcNqO9qjtPpU5g66srFDOxGnE7YQ7EIiD8zhE=; b=GvSoABLFiJkL5Yri5oKYIaBHn09eI8m24DPLlDKCayGWAzfXMw/iAFsmv4GOyPQWZO jdZ+gjjRWB6M7XgL1gk3zF3K0NzsaiwORj76hirS/f6VYLRBpsQhaMt/yjOBg4aLo+hO JwfGfpOx2nSWtuUAIGaPNP9GnQOKiQJiuwyNvpPRt0czZNgj2nEZv+lf+BOHPmJpPghN MPgojjVt4ktiv0TojTIavyVtGNO9E7q4Nyeh7/4WNqvDwafMli6DgncABdFnvRKtr26J whqX2xOmoFfuQf0DCDDSNuWls6PL0wx2XjN7cUdvNdHhjQ8SDRefLvEsI/T31AF40osG eyCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778578742; x=1779183542; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=OnY/BWGcNqO9qjtPpU5g66srFDOxGnE7YQ7EIiD8zhE=; b=iYoU+yxgtGUzWiYyO/iatX0R5bdriL/uJifKLEZE4NQKcnloNDe8ajmRc4pU7J1+61 b0cpv4WdmGXmvPw67mxUQ1rvBJwqWXpAj78U6Y72w8jG4miXvCuMzqO73XznS7HqjvYb cjT1HJiMRlrEWB7xuKrzDgFT6FOvvQF35MDaXcDfWxS4PR8h032gulRcPTnfDWjEYkLA Amz78fTm9K19pVll6SzFGJaH4MD7nACfeSiX8uJrpfu7O9q3V4gpE82guZeZhQIuXYrs mnD0QB0hnsW20hfok2ZP15STYy1xsSfjfPbTGdYKqHSQXsQbJZ/Szh3zvFpAUWYmytVD UtKg== X-Forwarded-Encrypted: i=1; AFNElJ+WQ9h30s4DndRibH59IlSmjX2bc82VVVtaUpLXUG0RTOiCX0xavxElTHwAB8AtAcNvpPhW6JNsqB/s@nongnu.org X-Gm-Message-State: AOJu0YxoTZ7TRWs7qoE3pANHNYJ5EXeafqYoiPAQospFvWKM7gNIX9aU 4SRVGnoY2i+uN2+RYb6Y/87n1qCNc/7jWY4px2NiYptgAMrUA/LFVoj3n4z5L6GTWYSISNMMaHm 5f7Qv X-Gm-Gg: Acq92OGTyPVdiBv8DH2exSVWOu9bIZSf4YknQAb2yMMVS6BFhG97nwtRbkWJ2fX86CF qVvB11P4nX7zyH83/D+d7ybozZcnOrm5ZxpbmL0oLdzpgdg2vfjOaf7PqjGEdn8dXZACfrhfrff LHgWWQpuYIm01j2WEgMrF8DdMVQOkYslA8qnLCYEJVkB3ntc4j8HK99hI6kmQfZ/78Xfw5EnIHf KXAYoSm6UnRE2QaCHuUWcQWGdULcbXwuCvzqkI26A6MPM1//dhKLNJOgJSbe+5K7sS2gysaEr1f zfUqsw4TPJfcpBvtmFVx8SKG0Uv+J+ZdjLtR/w41EGPFPFI1KyN/Wr+NcsGjEBJf6usp1J7kiUq TSyPSgU/bKsNwJXog1Ife6kDyb3aIkcYGSLYe5H/L+bxKViicLpkQ8feg4G1FWw9SZX/sWq3JwO M3AL+/C1xL2Cd1sqTAFs6bgdvhZdnNVFkMwWP/2+QQ+N931wnCTYfiqOvPJFOHQaaQSfYuPLdJL CZtiOt6jgbj2egO/o1wtTmiEg4N/+8o8POBcBQaBw== X-Received: by 2002:a05:600c:6099:b0:48e:6262:3df7 with SMTP id 5b1f17b1804b1-48e70811e67mr203168975e9.28.1778578742463; Tue, 12 May 2026 02:39:02 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 4/4] hw/intc/arm_gicv5: Add missing early return in gicv5_set_handling() Date: Tue, 12 May 2026 10:38:56 +0100 Message-ID: <20260512093856.3197700-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260512093856.3197700-1-peter.maydell@linaro.org> References: <20260512093856.3197700-1-peter.maydell@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1778578814290158500 Content-Type: text/plain; charset="utf-8" In gicv5_set_handling(), if the guest tried to set the handling mode on a nonexistent SPI then we print a GUEST_ERROR log message. However, we forgot to then return, so execution continues into a NULL pointer dereference. Add the missing "return", bringing the code structure in to line with the equivalent parts in other functions like gicv5_set_pending() and gicv5_set_target(). CID: 1659596 Fixes: 5beb48ab53d ("hw/intc/arm_gicv5: Make gicv5_set_* update SPI state") Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- hw/intc/arm_gicv5.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/intc/arm_gicv5.c b/hw/intc/arm_gicv5.c index 7ad274e369..6b1dd04991 100644 --- a/hw/intc/arm_gicv5.c +++ b/hw/intc/arm_gicv5.c @@ -926,6 +926,7 @@ void gicv5_set_handling(GICv5Common *cs, uint32_t id, if (!spi) { qemu_log_mask(LOG_GUEST_ERROR, "gicv5_set_handling: tried to s= et " "priority of unreachable SPI %d\n", id); + return; } =20 spi->hm =3D handling; --=20 2.43.0