From patchwork Mon Oct 31 22:00:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 620254 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp3126953pvb; Mon, 31 Oct 2022 15:01:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM71DybveqVjp89vDP3ML70ignDqGbtnIP6wEkaZVZ07BjmG/X6Y1a3B7Jct1wVVik7Qtx70 X-Received: by 2002:ae9:d884:0:b0:6fa:190:bd2a with SMTP id u126-20020ae9d884000000b006fa0190bd2amr10661630qkf.429.1667253703866; Mon, 31 Oct 2022 15:01:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667253703; cv=none; d=google.com; s=arc-20160816; b=SFKSyLa2/NscmfE1GtUGCjC5Bj1PAtMFFqk8AEO+WAKWxAQTFdubRau3u9iwHX+6cW 7BvyHNFYl2QtMeQ1agwBqBQD1xjzeZxCpLQc9wKBbjeYuuHH6oOwVFS91IeBfbLo5lLn 6Ta7EYjmV+9FKKZtXsM9U/dyIBnuhkyA0UrVSxHE7YCYaU/Sfuj8vn4MwMHPqWkyJ+YL 2olCpLYyRyg+JdxlA+aupcP5GY65WqLCBaUsomwcS41A0lplin7fJBv8ojxpCep3EVFv J9jGxDn/0lkbf3CRNegF/RgU2uPBUMz0p/3n+Rp9zjDSTO9392T5JqagDDDDZjS07XvS Xb9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9OVsqAmyqPbTHmE3w0Zkzp7OCwHypnqZuwBCZ2+0TpM=; b=qtDuZg/70Q/AGc0SVRd3gvkKaiCu+5aH9zItqopPFgwhluOvd4qdOWEmijJMXzLRWw BHuJIdto1ZcBATEf6AMv8v50GxVmd+86fkduGDf5rBRl2mV56/x7gN7k/5l0K5BHaDbW llYNFc6o6ifNCOydQnq6dAnXdNTyvmPXLM13FIKSQWF9uybKV/iREvn6dU4vfo6I8SdW noqljR1PEAtAxUvJmcLABm2t7karlo5MI2GkHOmVeKXM0fx5bwCQthu9U58NNcopWHZ0 s2xbFvuwH33OhTSeBJJ8kiAZq8TXbB9RB6Dgxyget47rmwK9g6qz3T+eoM25rkKOxOse gROg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="rFgJ/IJe"; spf=pass (google.com: domain of qemu-devel-bounces+peter.griffin=linaro.org+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+peter.griffin=linaro.org+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 w12-20020ac843cc000000b0039cb9395caasi4579987qtn.200.2022.10.31.15.01.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 31 Oct 2022 15:01:43 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+peter.griffin=linaro.org+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="rFgJ/IJe"; spf=pass (google.com: domain of qemu-devel-bounces+peter.griffin=linaro.org+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+peter.griffin=linaro.org+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 1opcpm-00054P-6M; Mon, 31 Oct 2022 18:00:42 -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 1opcpi-00053D-Ce for qemu-devel@nongnu.org; Mon, 31 Oct 2022 18:00:38 -0400 Received: from mail-io1-xd33.google.com ([2607:f8b0:4864:20::d33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1opcpf-0000pF-SY for qemu-devel@nongnu.org; Mon, 31 Oct 2022 18:00:37 -0400 Received: by mail-io1-xd33.google.com with SMTP id p184so10913188iof.11 for ; Mon, 31 Oct 2022 15:00:35 -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=rFgJ/IJeWfeTZKMUyHZrGxNOakgKpN5pRpCNlnHiJlUXGBSwh9CD7PXXieM5tZqtDe DA6ykZoS2mrwcRA1X6h6VLV+8CzeY2fr8kgYaOubsPMWYJgabcvUp2EB/n8siH5wbBU4 dYN7jZ+7/2UAxKzul6CaIFQc+PTWdVxr+FvPwlu5CHEmvy5TRBTU5XDca5CJnAISON66 O75rmy8DOqDYhP+Ugv/qgX3FfJQ4ttm5KSSY/X/S7iDftk6C86+/Fxn3sNtJQULakIlI Zf/BeiapkaGhnmb4UFHrr7Rtp4fipO8A8xjF0kpPLAf3lVSxrE7ubLKcIMro+WolGiTh T5JQ== 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=DEYhYxfv6RL6jmZJk4v8VyR8y6nk6pYxBx3P4iVFP6lxmBKmGdSlsa5JEt/WnAQE1u dVHrJOyswgskQoREEUCHYJZmRuNkp2MXCYQVN7QaTQOZzaQv3vNU5L8OSq1reozn5Ry2 MuT6h29QRRJt89MBhD5Upfu4p9NzEsqp9APXyka358wOo48zMfJug9QESgke/0UsqehJ amfPdH8DoGbIdqNnolc+sC2rhHt05KB+yGlLa7B0HrlvxPOMVrUm3//PN3ae4S2+SfPH swpi/t4jzbh1gp0IGq8uvoTB5YuQVMCgD5eUM1NSYieX5m3N9HogatvDI2lsBTZMh30m JQ3w== X-Gm-Message-State: ACrzQf1gXSbBaVt7/m1fgE6sQgcJE2f4Uedbkv8o1y7VGj/IEwJvf7q3 OlbBQc8TgfviPtHGsfySGDW4X7ij1/+xWg== X-Received: by 2002:a05:6602:1491:b0:6d2:c228:a157 with SMTP id a17-20020a056602149100b006d2c228a157mr1105220iow.116.1667253634691; Mon, 31 Oct 2022 15:00:34 -0700 (PDT) Received: from stoup.. ([172.58.176.58]) by smtp.gmail.com with ESMTPSA id d6-20020a926806000000b002f9537986f3sm2916853ilc.24.2022.10.31.15.00.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Oct 2022 15:00:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: stefanha@gmail.com, Icenowy Zheng , =?utf-8?q?Alex_Benn?= =?utf-8?q?=C3=A9e?= , =?utf-8?q?Philippe_Mathieu-Da?= =?utf-8?q?ud=C3=A9?= Subject: [PULL v2 04/13] tcg/tci: fix logic error when registering helpers via FFI Date: Tue, 1 Nov 2022 09:00:15 +1100 Message-Id: <20221031220020.414768-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221031215723.414467-1-richard.henderson@linaro.org> References: <20221031215723.414467-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::d33; envelope-from=richard.henderson@linaro.org; helo=mail-io1-xd33.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+peter.griffin=linaro.org+patch=linaro.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]; } }