Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp813218pxx; Tue, 27 Oct 2020 00:31:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzldQRMvJoKzFBgQ1ZyHFDOC8OwVDmX3Tf3CrgQJNLY8Doh63s/u53+XD+k0YHMmDMhgC2f X-Received: by 2002:a17:906:eb59:: with SMTP id mc25mr1093449ejb.34.1603783910476; Tue, 27 Oct 2020 00:31:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603783910; cv=none; d=google.com; s=arc-20160816; b=dOUX2v4fXaCKcm3XuXO/03ssRYSKw9UU0dvI4E1mBErXrAy5QsBQJk19h77bHKaK+p PAInhPXD5NRP0NWeThrowaRin3w9Ed/Tmyzs2OCgP8CBDVWNSCl6WcBk6WHV2IohA+xk FFEyn+3TPaRV23aUSocHMvgwFodaHtWpRiAeP7RJYcA13UB2QhDduSqBA5IZmdgDuNQY Ty9BdydiIER7cC1fDz2JAihs+GxIWDZIE8YZy37XTDjhiL+nJH8OHx6E2Htb3kx6JRrR +drO8j06CaC4d/Hw/TnJcsrXx+VwnwSgNyu3YyVragi1n5II0eQTt1WHqSMnITPMHOge KLXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=iMyaTiS8s4IZZPKOol8bFIrJh3rVDKLp4Mu8RWN6Jc4=; b=jpxBJ/bpnRkCk8B4onmOSi9iJyn4bZeCf5ibigCI4RhiDdGq4VhS2myVeaxPoA6V0a 5LdG2ScFgOW2Zf8WSGfYfKteR+rLAk5mu8uRKPrx5X19sS2mSkhPlamHDqWCfUAtiHTw YzQWDz2rvzK6zIb67fkfZLLFfKDZk3sntzvAba27s5C5dY9MSHrBebhyMCrxAOF2SXAP jodhmASuj5Tmue8Mb7S45JtTvp6VbG2M50n1vbOM+xDJi+E0G8CUVTf5vf+Qo5qbEdaS OpMstSvEWpNwPzSKCEvPoN1BQ+zFT/wSD0a+zduginiJxyWxwcLrmAXbxGsQbXTQaknp B6Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zPARCHdA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qk3si532423ejb.207.2020.10.27.00.31.28; Tue, 27 Oct 2020 00:31:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zPARCHdA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729553AbgJZVDm (ORCPT + 99 others); Mon, 26 Oct 2020 17:03:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:57738 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729508AbgJZVDm (ORCPT ); Mon, 26 Oct 2020 17:03:42 -0400 Received: from localhost.localdomain (unknown [192.30.34.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 18EE72076D; Mon, 26 Oct 2020 21:03:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603746221; bh=OZnv8+PjDr0EFxf38kgdpGPhhv077FnV6tC8I5FI3EI=; h=From:To:Cc:Subject:Date:From; b=zPARCHdA9ue578l2WNv3HF5JQC66D+2G1czAaiUWHuljt43wVHu9Ag64RWvezDW5S 96QhQmAsHFlZfscCcGj7/BKu6q28YWewp7nWSScDPjVBtaxMkKtwKLm6knI2CKKcAt nMNlKljZpXWPhqWmn7Ho1uzZPEqQmeLNMj50ILXk= From: Arnd Bergmann To: Alexei Starovoitov , Daniel Borkmann Cc: Arnd Bergmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , John Fastabend , KP Singh , David Miller , Thomas Gleixner , Jakub Sitnicki , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Jiri Olsa , Pankaj Bharadiya , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] bpf: suppress -Wcast-function-type warning Date: Mon, 26 Oct 2020 22:03:20 +0100 Message-Id: <20201026210332.3885166-1-arnd@kernel.org> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann Building with -Wextra shows lots of warnings in the bpf code such as kernel/bpf/verifier.c: In function ‘jit_subprogs’: include/linux/filter.h:345:4: warning: cast between incompatible function types from ‘unsigned int (*)(const void *, const struct bpf_insn *)’ to ‘u64 (*)(u64, u64, u64, u64, u64)’ {aka ‘long long unsigned int (*)(long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int)’} [-Wcast-function-type] 345 | ((u64 (*)(u64, u64, u64, u64, u64))(x)) | ^ kernel/bpf/verifier.c:10706:16: note: in expansion of macro ‘BPF_CAST_CALL’ 10706 | insn->imm = BPF_CAST_CALL(func[subprog]->bpf_func) - | ^~~~~~~~~~~~~ This appears to be intentional, so change the cast in a way that suppresses the warning. Signed-off-by: Arnd Bergmann --- include/linux/filter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/filter.h b/include/linux/filter.h index 1b62397bd124..20ba04583eaa 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -342,7 +342,7 @@ static inline bool insn_is_zext(const struct bpf_insn *insn) /* Function call */ #define BPF_CAST_CALL(x) \ - ((u64 (*)(u64, u64, u64, u64, u64))(x)) + ((u64 (*)(u64, u64, u64, u64, u64))(uintptr_t)(x)) #define BPF_EMIT_CALL(FUNC) \ ((struct bpf_insn) { \ -- 2.27.0