Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp837582pxx; Tue, 27 Oct 2020 01:23:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwM0oWs8lvVN40uOV/SSWfvoaZL4HojPqeBeflm2Q72KooNDorhRHtmpJE+5jqLHhg2+9T6 X-Received: by 2002:a50:8a02:: with SMTP id i2mr1072510edi.40.1603786992995; Tue, 27 Oct 2020 01:23:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603786992; cv=none; d=google.com; s=arc-20160816; b=s2u1sauKdm0pHNSm8MwOI4amQMbkjtPL8m5mub6j1n550FPE0yxuake2BUxZ+eWnC3 lCWpoxiEe7YWRYRjKUaMYIQXQpRzh2tZuBddngHbtWUV1PYbRd0fGhIqlZYN/rUya0P1 l6Du5UXXKWdiWAVbb80aMxwoFdY0cCDpCNfqLHeXNPNtz3AJVy/EPizZwWbdWR1G7PkZ AHOw1mCNSVftk1SUyfIWimas9c9dBaBvJ1uBMwHsbsI4IduL3rLmiVoJVo464JOM2vdH xnTkxxaliXupNOcFd3WU+5nu7Asl+YYG9WQ1Te2kWOh6soa1uHK23OR8DE72kuH56RWq i/FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=VzKLIOn5ZNMh+ZqIZ5v07+6ceTHcQcV1XTB2DtB+0Ts=; b=GQBCdUVi6fyeF9RapxaaS4Fgr72q/Lq+D2DiVx1ZPES5ox0IzMbn/wlE6XqNHDB5NS Oh8c8tCkZmF6VvMgU/UtnioqQQolF5wZB6idImysedg7Nessyk9yfBskL/gJGd/6vKq1 LGXvWmr6ucxzjhfUGQ+WaNIIIor2UcSlL1i4Egq2EGMkbhzCWVBv48vLQlBGzR89Qk/8 cOj2blC9jg+9F6i5n9YCuS87d84RJKJr2gydvJ4GZoflFX5vZQOTwoMT/pbLMhE4+wZT qoMzPnFn+Bcvh73ctTvi8e+n4XfawVWMDAJfBPm09npyv6XOvGczR0JwQYAuFz8oa/aw uH2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nQDbuLLq; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gt22si472120ejb.571.2020.10.27.01.22.50; Tue, 27 Oct 2020 01:23:12 -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=@gmail.com header.s=20161025 header.b=nQDbuLLq; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394332AbgJZW00 (ORCPT + 99 others); Mon, 26 Oct 2020 18:26:26 -0400 Received: from mail-yb1-f196.google.com ([209.85.219.196]:42625 "EHLO mail-yb1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394247AbgJZW0X (ORCPT ); Mon, 26 Oct 2020 18:26:23 -0400 Received: by mail-yb1-f196.google.com with SMTP id a12so9017609ybg.9; Mon, 26 Oct 2020 15:26:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=VzKLIOn5ZNMh+ZqIZ5v07+6ceTHcQcV1XTB2DtB+0Ts=; b=nQDbuLLq1Djc0WyhCdBgEHdTisZtMaVebC8GnV+hrMP6JI4XeeJVig9a6Zfjsg53yx MevxN8yNaidpf2Uekxj0qq4eRVuEPdaZlWpblKVTG8B5TEl/W+iYGxXzN1IqQCXMghGo nOW16tmbpqcTwkE22hJLZDw6kiGht34Pj8pM7dsEKaD/J+3WSBs5IlCrBBeupiSxs2cG rGR8PXVFG0ofiUYcTp9GfxlUj23WMDhnHAY9hGUOfZSCOLrMHhkPsejM4LK0yUuhc15E rEFQNNJMh9c0QgJFFQxz8eH+4nqmUvpL4JBQTxby8Ha2jFCHQ5JZ00iSXCyrWLIO1O/Q BC5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=VzKLIOn5ZNMh+ZqIZ5v07+6ceTHcQcV1XTB2DtB+0Ts=; b=roqICu8lh9dXPkhigrt1oHifv/o4fZCJK5VH1VQS2jBdr1dVN6UoAyjTT4EdeRjCoo Jex3+6R65ks+g9McYCFCh1Pj1Oa98SHDNd4xauapSkRdYkEfD1rk3Ak+0J1ZupsQOXW8 ylFmDH36Xu09Fouw5yyT0smJeaxSAauc9lRr8VrWaueW/XOBURf5IxeVsIPf9jJX+H78 Lyh+gOsUV0uBNFG8OV1vAhthg11vkGj4YroxbLwlyTyqcWFCmzb68GZdd0/4YvMrXf+w aLxutr580AMmDw2LZ2pQFeU9Ul+Za8jdFnElKOJ8HBcMafS0QOC9XFgTFOnQ6IRsgB+e jUvg== X-Gm-Message-State: AOAM530xvdJ+SWIpdC40ByvmYKRKXmIpSri+J/X0LZ185LMdxXctDZC5 GhHmux2Rbn1nBh6PD2sBQHao/4pKJ4i80PoU2HA= X-Received: by 2002:a25:cb10:: with SMTP id b16mr23857239ybg.459.1603751182707; Mon, 26 Oct 2020 15:26:22 -0700 (PDT) MIME-Version: 1.0 References: <20201026210332.3885166-1-arnd@kernel.org> In-Reply-To: <20201026210332.3885166-1-arnd@kernel.org> From: Andrii Nakryiko Date: Mon, 26 Oct 2020 15:26:11 -0700 Message-ID: Subject: Re: [PATCH] bpf: suppress -Wcast-function-type warning To: Arnd Bergmann Cc: Alexei Starovoitov , Daniel Borkmann , 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?B?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vuc2Vu?= , Jiri Olsa , Pankaj Bharadiya , Networking , bpf , open list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 26, 2020 at 2:03 PM Arnd Bergmann wrote: > > From: Arnd Bergmann > > Building with -Wextra shows lots of warnings in the bpf > code such as > > kernel/bpf/verifier.c: In function =E2=80=98jit_subprogs=E2=80=99: > include/linux/filter.h:345:4: warning: cast between incompatible function= types from =E2=80=98unsigned int (*)(const void *, const struct bpf_insn *= )=E2=80=99 to =E2=80=98u64 (*)(u64, u64, u64, u64, u64)=E2=80=99 {aka = =E2=80=98long long unsigned int (*)(long long unsigned int, long long unsi= gned int, long long unsigned int, long long unsigned int, long long unsi= gned int)=E2=80=99} [-Wcast-function-type] > 345 | ((u64 (*)(u64, u64, u64, u64, u64))(x)) > | ^ > kernel/bpf/verifier.c:10706:16: note: in expansion of macro =E2=80=98BPF_= CAST_CALL=E2=80=99 > 10706 | insn->imm =3D 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 > --- LGTM. 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) { \ > -- > 2.27.0 >