Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1976366ybv; Fri, 14 Feb 2020 09:10:44 -0800 (PST) X-Google-Smtp-Source: APXvYqwyvg4iTvyRhPlp31Tq2UccejPNb7+OKs6aeayg4bieW74rcXrfDjIpDy0uZCLFvmMy3ZxO X-Received: by 2002:aca:2315:: with SMTP id e21mr2531423oie.147.1581700244344; Fri, 14 Feb 2020 09:10:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581700244; cv=none; d=google.com; s=arc-20160816; b=mtpZNDD+rLB9Wxshv12LcaWBEsMD2dROSRLHmEY+d6oRwxggPNBoYssNcNguVAWOPn vTAXMS/h5jHgNoLWTGa1hj1xdpwgWHHI6LecTb4OrXryOp09b1f0f2OWemhyls/qqT8A xMqQu5kMycJxY3Pt7pRAziRkmeA0ePb8Ty2PviPT1HxyJXASnL7D3WWNUYrqF7g1xD7A CtoxMk0uMBcGHfgMPcqGw3hTA3puuEvrcW7QvJHtMclSH5bUGBIdmwhhkrTAyvm7VtE1 L7X6L4JxKW+WBpvbQrc//uwTFDcJAPJr7x3nRc8pltICbB6uuUvK7ME4KnxqALkmAGI1 a/Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=fXvyu0kZf5A1U63q/YhyFfRXYuCW/78tH+0468+IS98=; b=r9qg34n6nwDMXslDfCYD56Wn7nvH/DErSbe84oojVXOXG6lcNaWl2o2FYSckQO3YxX Wobmt38j8OuiowRZOJfafuEJ6fiphzluWBN6Dct/7NKeRDr8FkGKCwk8d9xqa4V/3VEq 8EKDv7FgOcD18hZvSp0C+NGgyR3UrOM2PPuEPkp9nGN5QN3+mGlfqLrPBiA2XUE0asVF I+l1kfANCJqtCmXj6kbUz/2POezIeSfpqBK6vwFIiaBQAMbz2cTeFMQmqfUzYpKMlk/v L/LnpRVRuX+X+a0BkUXt5ZZmxQwtwTUiuvSTYTX0p+wYTx5+7t3urcJRO0ahe3EVeyth qrWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b="YFJ/kMLj"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o6si2680072oie.193.2020.02.14.09.10.31; Fri, 14 Feb 2020 09:10:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b="YFJ/kMLj"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404214AbgBNRIv (ORCPT + 99 others); Fri, 14 Feb 2020 12:08:51 -0500 Received: from mail-qk1-f193.google.com ([209.85.222.193]:33807 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389975AbgBNRIs (ORCPT ); Fri, 14 Feb 2020 12:08:48 -0500 Received: by mail-qk1-f193.google.com with SMTP id c20so9900328qkm.1 for ; Fri, 14 Feb 2020 09:08:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lca.pw; s=google; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=fXvyu0kZf5A1U63q/YhyFfRXYuCW/78tH+0468+IS98=; b=YFJ/kMLjchBhiT8aNq0VrtM4AcJeWee2US4hluINe65IunCXS3vJuj4Bkbt4gqrlc9 xSK8WM66btieYfHnX95r5cKhvH7E17po1pg7gSr6OevWFmVmk8Cql8RHZFeuHCv08hwf 3/sxsLR7FFiN7OKwP0erO9lLPFlmPWzw4WIgrDmrtzTYg3Eav+OtYw0SPSr59xFJ5kcq teKwvCq9AEwvlyWG0mAayZa01tij9LomvrQ+gp5Wr2P3JSgZAUqg2qTZPUv8OPkhrrNf kGV8o4do/4/KGXvJrd/ylkT265lwoafDkZa+Ox1SowWFpDIen1G/c3gxYprXLAOJ/fLX gJ/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=fXvyu0kZf5A1U63q/YhyFfRXYuCW/78tH+0468+IS98=; b=qkamqkEhRHaDPqYrF7gNzKLZJVvYdQzQaQ1AW/6dfYtyGwevc3LkZLccYmnPTBolV3 IkwNYMDTeZVNIWc4D+wi9okjRe2zy7uSRsO/KWzKBB+5e/uCaneWGq845zamdeyaR7gf PlljCD5VohhyqSeo4tne5CLE0gjI0vV615USqMmjt8Av49D5pwIBoY0jDd7r1edEJn/B qKd0qaNTEfg8SYzU0CCaz79pwPZqL71m+2Cd7UOR+kOi3PKPpc/csJ6O82YepB0fzzKA IIbEMHOKBephP6TwL5vKNVgur2fN6Mt9kJkXstU1v28ib4K5Xosb09E+no2MgGSlG4kb +5RQ== X-Gm-Message-State: APjAAAUBk2ASVvKl2pQMjnLsuRiFoxkzahhuw5FzybKBupjZp3wGX5z1 ZOZ8Ua4f3ttaD0bAl0yhC21OnSt/fhHIlQ== X-Received: by 2002:a05:620a:13a9:: with SMTP id m9mr3571942qki.359.1581700126842; Fri, 14 Feb 2020 09:08:46 -0800 (PST) Received: from dhcp-41-57.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id r1sm3538113qtu.83.2020.02.14.09.08.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Feb 2020 09:08:46 -0800 (PST) Message-ID: <1581700124.7365.70.camel@lca.pw> Subject: Re: [PATCH] kvm/emulate: fix a -Werror=cast-function-type From: Qian Cai To: Sean Christopherson Cc: pbonzini@redhat.com, vkuznets@redhat.com, wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 14 Feb 2020 12:08:44 -0500 In-Reply-To: <20200214165923.GA20690@linux.intel.com> References: <1581695768-6123-1-git-send-email-cai@lca.pw> <20200214165923.GA20690@linux.intel.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6 (3.22.6-10.el7) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2020-02-14 at 08:59 -0800, Sean Christopherson wrote: > On Fri, Feb 14, 2020 at 10:56:08AM -0500, Qian Cai wrote: > > arch/x86/kvm/emulate.c: In function 'x86_emulate_insn': > > arch/x86/kvm/emulate.c:5686:22: error: cast between incompatible > > function types from 'int (*)(struct x86_emulate_ctxt *)' to 'void > > (*)(struct fastop *)' [-Werror=cast-function-type] > > rc = fastop(ctxt, (fastop_t)ctxt->execute); > > > > Fixes: 3009afc6e39e ("KVM: x86: Use a typedef for fastop functions") > > Signed-off-by: Qian Cai > > --- > > arch/x86/kvm/emulate.c | 8 +++++--- > > 1 file changed, 5 insertions(+), 3 deletions(-) > > > > diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c > > index ddbc61984227..17ae820cf59d 100644 > > --- a/arch/x86/kvm/emulate.c > > +++ b/arch/x86/kvm/emulate.c > > @@ -5682,10 +5682,12 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt) > > ctxt->eflags &= ~X86_EFLAGS_RF; > > > > if (ctxt->execute) { > > - if (ctxt->d & Fastop) > > - rc = fastop(ctxt, (fastop_t)ctxt->execute); > > Alternatively, can we do -Wno-cast-function-type? That's a silly warning > IMO. I am doing W=1 on linux-next where some of the warnings might be silly but the recent commit changes all warnings to errors forces me having to silence those somehow. > > If not, will either of these work? > > rc = fastop(ctxt, (void *)ctxt->execute); > > or > rc = fastop(ctxt, (fastop_t)(void *)ctxt->execute); I have no strong preference. I originally thought just to go back the previous code style where might be more acceptable, but it is up to maintainers. > > > - else > > + if (ctxt->d & Fastop) { > > + fastop_t fop = (void *)ctxt->execute; > > + rc = fastop(ctxt, fop); > > + } else { > > rc = ctxt->execute(ctxt); > > + } > > if (rc != X86EMUL_CONTINUE) > > goto done; > > goto writeback; > > -- > > 1.8.3.1 > >