From patchwork Mon Oct 26 21:03:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11858797 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E62CC4363A for ; Mon, 26 Oct 2020 21:03:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E4B7E20829 for ; Mon, 26 Oct 2020 21:03:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603746223; bh=OZnv8+PjDr0EFxf38kgdpGPhhv077FnV6tC8I5FI3EI=; h=From:To:Cc:Subject:Date:List-ID:From; b=l2E5D9/ZjfuySkAhJIaNT0rtXxH7pNutyxJxl6TFXcT6MWHrz3KHy6OLoPRbLYrHE hTn58jQSh/y86/0QaRPUqR++dG+k/hz1qa+ocnf993w037L8cSsxLKCKrlNoDcuvqc rMrXSjDSdChg4U75lvjLhxIhu2dnCSFwrkDUufW4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729515AbgJZVDm (ORCPT ); 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?b?QmrDtnJuIFTDtnBlbA==?= , =?utf-8?q?Toke_H?= =?utf-8?q?=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 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org X-Patchwork-Delegate: bpf@iogearbox.net 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 Acked-by: Andrii Nakryiko --- 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) { \