From patchwork Fri Feb 23 08:32:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 775129 Delivered-To: patch@linaro.org Received: by 2002:adf:a356:0:b0:33b:4db1:f5b3 with SMTP id d22csp238528wrb; Fri, 23 Feb 2024 00:33:22 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU96iTRIs2OwQ6xClDVisQkr4iCxJkuG6MimjfHWnrfwTgZEQurMpyWGdZirYEHPmK06x8FnY2LLSKEl88ddFjv X-Google-Smtp-Source: AGHT+IHoXkn5EJv5tu8qJZU3IUTXbeXy7h8kDw89lU0PfBds4ISgu2KHGX3bKPvstWuUdW97FUJ1 X-Received: by 2002:a05:620a:4388:b0:784:71a6:f8df with SMTP id a8-20020a05620a438800b0078471a6f8dfmr1978083qkp.44.1708677201738; Fri, 23 Feb 2024 00:33:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708677201; cv=none; d=google.com; s=arc-20160816; b=pIGdIgzbHQ9vIgpiHp/aLhRGiPR4Rb8X4lyp4SVVO5hE+sLIdobbhs4kb6KPgm9jy8 XZI2hG20fCRx0bJyro/S2aS2/EZO59aHaPefYQOcP8gxWH5K+5hE8SOTDwsd5QMleqxD bLQtZW54DfTUhg9oIv3EvA99/oB2iSGzMuQgYMq9gokLQCdNPMbrqb/sRFA203aHNxnq 3WySqwqzdv5xzdkPT/egbliAK5fDECEP05zxlKVkpDZiNBOO9qneQXJH35hJygj2Wi5E iD01Y+xHkV/iiKCgTftmEShPAyNFhKx6CeNBdB5RZb33l6grH3t2b+oXAxo1rJlSIfrc Cjfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=Uq2awk8nJO2BrLl428ae84YlkT7Ql/QRWd4SAtS9N7o=; fh=Xy9KMVARrQFDlCiHmmCqFYxjiYExZODsqlgUY2H4dWU=; b=kIMFU4SkYU3PtrBpI14Ze8a6zemCWWbvDA5TUgszGTXrhm84bNWetsAxH1WWTLU7yy tiKgLmSO0FWGpvBIj3KIdetzHMxdmUBSyE/nrWqg0aq5f0k+PoZgEzHQNmk3MR+n2cKw HQHo1zqs7UTtu+R7S5tUHB3JiakQtbjype3NcLqKzkchsfuwz5pOMIwbBu+UJFgw28qk VglVt/ggCYoFRaAi48y9jTYz7plh3+9bgddZobb/OqeOouQodQlw02d+92d7jqj98yyM 80IxHsOXevM8f5N5LCBxTU4YjVgIWylWKO5K67+vOYA5oLJV6aYO5yjYHHH92tIeFBR8 QxcA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="l0NqPI6/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id wh11-20020a05620a56cb00b00787b81d4660si129217qkn.670.2024.02.23.00.33.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 23 Feb 2024 00:33:21 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="l0NqPI6/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdQzS-0003MT-LR; Fri, 23 Feb 2024 03:33:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdQzR-0003M3-1X for qemu-devel@nongnu.org; Fri, 23 Feb 2024 03:33:05 -0500 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rdQzD-0006uZ-5z for qemu-devel@nongnu.org; Fri, 23 Feb 2024 03:33:04 -0500 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-563bb51c36eso82102a12.2 for ; Fri, 23 Feb 2024 00:32:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708677169; x=1709281969; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Uq2awk8nJO2BrLl428ae84YlkT7Ql/QRWd4SAtS9N7o=; b=l0NqPI6/rMIH3/9WQgbHOT2bO6yQkvh4aI6UVN4604XuEyTbWVdrdzNEyAXKbIRm+9 6T4Z8oWcNEzarh+6VV0qXW8VRjdL2f3sVELyB0vZkqgh0ZrvAZmiBDoWDX/QwSBDjeY9 N14na4NnbiMtm/Kh6rWg/HtaqLFQrbWVHru8lgPZ2RpMBG4GhFczoZ/4HPHC+l61Bj+r QyK5/cmBMv8TqQWrz1pbmXY8wGbRMvDbeybQm/g9M9njtjl2Ue4TrW0dhu0WKbXfF0sg axlhGfZRq77kJihH9kb5CZeueRw2zsWjkt4njY+VFFO9WGd6wYfOZ9oiOVjHaPhCvTkK sPWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708677169; x=1709281969; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Uq2awk8nJO2BrLl428ae84YlkT7Ql/QRWd4SAtS9N7o=; b=OcP8fKftkp3G9Hr6u3G1eKaE1J/OfxGXl5Bn9XSf8igIG2/0Sr3qrWRTzv1+bTItqR PmwvAIyUzTdDDE7LT6NM6WEPmsFYMRwpFxLxH5GAjMdA54mtIIik1lc7lcp5LDKUfnkY rS7WzSHV7nhUNktt58nPp/Uus35Y5RMW9LEmlBfg7OahEW7RFYqiVvXBf+mABiwfTvDC YM2y8IQqW7+en8zProe+Ctc9CXkiMp+0dru84FqY0FKoj0VO8Sl9LarVdrOE5sqnha28 wYwtgFIWhWG0EZuHlJ+CmjXf7+fo/Rv6GqqV0hFG4SXplG59SftHPqjNuPZGKkISOIHJ 6nmA== X-Gm-Message-State: AOJu0YzlYznq93Qc2UhrN4eomNBAxP8l6LljEtJGASN1Rpp3RHgwW/I5 tE1xmhroywvzBaCRWH0FEF6DL8R5PGsOhNDTCBVFrqQ9JDwISH3lcFWGjKnbvAv8xDHHyyFM1oK uxww= X-Received: by 2002:a17:906:4813:b0:a3f:a3bc:1444 with SMTP id w19-20020a170906481300b00a3fa3bc1444mr716138ejq.54.1708677168956; Fri, 23 Feb 2024 00:32:48 -0800 (PST) Received: from m1x-phil.lan (sto95-h01-176-184-18-96.dsl.sta.abo.bbox.fr. [176.184.18.96]) by smtp.gmail.com with ESMTPSA id wn2-20020a170907068200b00a3e6f22f21dsm5294894ejb.54.2024.02.23.00.32.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 23 Feb 2024 00:32:48 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?C=C3=A9dric_Le_Goater?= , Nicholas Piggin , Thomas Huth , Daniel Henrique Barboza , qemu-ppc@nongnu.org, =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , =?utf-8?q?Phi?= =?utf-8?q?lippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH] target/ppc/mmu: Silent maybe-uninitialized error in ppc_hash64_xlate() Date: Fri, 23 Feb 2024 09:32:45 +0100 Message-ID: <20240223083245.80175-1-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52f; envelope-from=philmd@linaro.org; helo=mail-ed1-x52f.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, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Initialize apshift to avoid a maybe-uninitialized error: C compiler for the host machine: cc -m64 -mbig-endian (gcc 13.2.0 "cc (Debian 13.2.0-10) 13.2.0") C linker for the host machine: cc -m64 -mbig-endian ld.bfd 2.41.90.20240115 Host machine cpu family: ppc64 Host machine cpu: ppc64 ... target/ppc/mmu-hash64.c: In function 'ppc_hash64_xlate': target/ppc/mmu-hash64.c:1154:15: error: 'apshift' may be used uninitialized [-Werror=maybe-uninitialized] 1154 | *raddrp = deposit64(pte.pte1 & HPTE64_R_RPN, 0, apshift, eaddr); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ target/ppc/mmu-hash64.c:947:14: note: 'apshift' was declared here 947 | unsigned apshift; | ^~~~~~~ The call chain is: ppc_hash64_xlate -> ppc_hash64_htab_lookup -> ppc_hash64_pteg_search ppc_hash64_pteg_search() either sets *pshift or returns -1, ppc_hash64_htab_lookup() returns if ppc_hash64_pteg_search() returned -1: 1068: ptex = ppc_hash64_htab_lookup(cpu, slb, eaddr, &pte, &apshift); 1069: if (ptex == -1) { 1070: if (!guest_visible) { 1071: return false; 1072: } ... 1087: return false; So IIUC this "uninitialized use" can not happens. Signed-off-by: Philippe Mathieu-Daudé --- I had this in an old branch (2 months old) I just rebased, and don't get why nobody else got this error yet. --- target/ppc/mmu-hash64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/ppc/mmu-hash64.c b/target/ppc/mmu-hash64.c index d645c0bb94..cd1e0c13c8 100644 --- a/target/ppc/mmu-hash64.c +++ b/target/ppc/mmu-hash64.c @@ -944,7 +944,7 @@ bool ppc_hash64_xlate(PowerPCCPU *cpu, vaddr eaddr, MMUAccessType access_type, CPUPPCState *env = &cpu->env; ppc_slb_t vrma_slbe; ppc_slb_t *slb; - unsigned apshift; + unsigned apshift = 0; hwaddr ptex; ppc_hash_pte64_t pte; int exec_prot, pp_prot, amr_prot, prot;