From patchwork Mon Oct 31 05:39:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 1697007 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=UNYOaaYZ; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4N127g2X1Vz23ld for ; Mon, 31 Oct 2022 16:41:01 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1opNX9-0001bf-4g; Mon, 31 Oct 2022 01:40:27 -0400 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 1opNX8-0001bJ-0d for qemu-devel@nongnu.org; Mon, 31 Oct 2022 01:40:26 -0400 Received: from mail-ot1-x32f.google.com ([2607:f8b0:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1opNX6-0003mU-6U for qemu-devel@nongnu.org; Mon, 31 Oct 2022 01:40:25 -0400 Received: by mail-ot1-x32f.google.com with SMTP id w26-20020a056830061a00b0066c320f5b49so3909721oti.5 for ; Sun, 30 Oct 2022 22:40:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9OVsqAmyqPbTHmE3w0Zkzp7OCwHypnqZuwBCZ2+0TpM=; b=UNYOaaYZ3FhPCyRhkIlnn8n8h4/bd8c82EJGRZh2dFysSIB8j6Qf0RJNT2rTrqZ+JF K64r4P7PMYvGVm5JzHK09Mbx2N75sCJbHa2I5qNm7HfVtaOR2yBwTyWvXAQg9Rij2+nh KfM2EPjrlxx5twUoSXcdYMPiXicQTsvNtldzYCH0kanx5zEn8+3PFTvnsDL9Ea7vFCHP /fcIhCRPf+98/sx96Jk9aJ0T33/MQvgiUS1sZLb+cNABd832RLiI5k9sV01sNLKGNE51 S4mqaoCs2+lu3jjfRxwlnhO02BWozbOTIGQF8sznLG0e3LjJggMvI2m/4pxswlCtCqkZ 4VHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9OVsqAmyqPbTHmE3w0Zkzp7OCwHypnqZuwBCZ2+0TpM=; b=FxxRuDiZpopL04VyJ+lqeUS/lDFVATXXdUiNgjuBelGdPRAXRzHf4g7c0a1V4HJOOg Q/Fdlei+pxaadMF20pjsY7tUpm1wA453zoF+cFyZPvj+3g1vT0SqmYpsFQjafu9Vd3JI 8pbIDAlAC63azHMyQ3TTN040S7TlgEO7nmYwBZ+6ZCO+zppzkVGffgl6ZsZv8jblIAb2 3PXoOzX6lGleCAE2FF9SxSKAl1O3yQvM7rPDPbMaTqiLzp1QT2oz+7DQcRkA2n1k0O9p 7YbJOgA7uPApL/CsLKigvraXLqfsOvh/CTtLRP0I2RmlmXHqiNlmTsogceAJuVIoM/g5 MbiA== X-Gm-Message-State: ACrzQf3xIJJBzCQK0OUEZQfnS+bIS0a05yTmiBf9LHay31Y8gQ3CFtpq VbuMtKAMLzSUcYzdbvJb1Om9GIxa8SIeqg== X-Google-Smtp-Source: AMsMyM45LapvvE4Ut6NvzhxlNz/JV7ZgZwtgLDpGtdSbQMUw1tyXyeKNpXwj0q6Zm9pLz24/D/jm+A== X-Received: by 2002:a9d:5f82:0:b0:638:eab8:14a4 with SMTP id g2-20020a9d5f82000000b00638eab814a4mr5724758oti.71.1667194821777; Sun, 30 Oct 2022 22:40:21 -0700 (PDT) Received: from stoup.. ([172.58.176.235]) by smtp.gmail.com with ESMTPSA id u8-20020a9d4d88000000b006618586b850sm2473857otk.46.2022.10.30.22.40.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Oct 2022 22:40:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Icenowy Zheng , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= Subject: [PULL 04/11] tcg/tci: fix logic error when registering helpers via FFI Date: Mon, 31 Oct 2022 16:39:41 +1100 Message-Id: <20221031053948.3408-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221031053948.3408-1-richard.henderson@linaro.org> References: <20221031053948.3408-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32f; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32f.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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Icenowy Zheng When registering helpers via FFI for TCI, the inner loop that iterates parameters of the helper reuses (and thus pollutes) the same variable used by the outer loop that iterates all helpers, thus made some helpers unregistered. Fix this logic error by using a dedicated temporary variable for the inner loop. Fixes: 22f15579fa ("tcg: Build ffi data structures for helpers") Reviewed-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Icenowy Zheng Message-Id: <20221028072145.1593205-1-uwu@icenowy.me> [rth: Move declaration of j to the for loop itself] Signed-off-by: Richard Henderson --- tcg/tcg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index c9e664ee31..b6c46b7e25 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -634,9 +634,9 @@ static void tcg_context_init(unsigned max_cpus) if (nargs != 0) { ca->cif.arg_types = ca->args; - for (i = 0; i < nargs; ++i) { - int typecode = extract32(typemask, (i + 1) * 3, 3); - ca->args[i] = typecode_to_ffi[typecode]; + for (int j = 0; j < nargs; ++j) { + int typecode = extract32(typemask, (j + 1) * 3, 3); + ca->args[j] = typecode_to_ffi[typecode]; } }