public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavoars@kernel.org>
To: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: "Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	Kees Cook <keescook@chromium.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Next Mailing List <linux-next@vger.kernel.org>
Subject: Re: linux-next: build warning after merge of the kspp-gustavo tree
Date: Wed, 29 Sep 2021 19:05:45 -0500	[thread overview]
Message-ID: <20210930000545.GA358523@embeddedor> (raw)
In-Reply-To: <20210930095300.73be1555@canb.auug.org.au>

On Thu, Sep 30, 2021 at 09:53:00AM +1000, Stephen Rothwell wrote:
> Hi all,
> 
> After merging the kspp-gustavo tree, today's linux-next build (powerpc
> ppc64_defconfig) produced this warning:
> 
> kernel/trace/ftrace.c: In function 'ftrace_ops_get_list_func':
> kernel/trace/ftrace.c:128:31: warning: cast between incompatible function types from 'void (*)(long unsigned int,  long unsigned int)' to 'void (*)(long unsigned int,  long unsigned int,  struct ftrace_ops *, struct ftrace_regs *)' [-Wcast-function-type]
>   128 | #define ftrace_ops_list_func ((ftrace_func_t)ftrace_ops_no_ops)
>       |                               ^
> kernel/trace/ftrace.c:174:10: note: in expansion of macro 'ftrace_ops_list_func'
>   174 |   return ftrace_ops_list_func;
>       |          ^~~~~~~~~~~~~~~~~~~~
> kernel/trace/ftrace.c: In function 'update_ftrace_function':
> kernel/trace/ftrace.c:128:31: warning: cast between incompatible function types from 'void (*)(long unsigned int,  long unsigned int)' to 'void (*)(long unsigned int,  long unsigned int,  struct ftrace_ops *, struct ftrace_regs *)' [-Wcast-function-type]
>   128 | #define ftrace_ops_list_func ((ftrace_func_t)ftrace_ops_no_ops)
>       |                               ^
> kernel/trace/ftrace.c:207:10: note: in expansion of macro 'ftrace_ops_list_func'
>   207 |   func = ftrace_ops_list_func;
>       |          ^~~~~~~~~~~~~~~~~~~~
> kernel/trace/ftrace.c:128:31: warning: cast between incompatible function types from 'void (*)(long unsigned int,  long unsigned int)' to 'void (*)(long unsigned int,  long unsigned int,  struct ftrace_ops *, struct ftrace_regs *)' [-Wcast-function-type]
>   128 | #define ftrace_ops_list_func ((ftrace_func_t)ftrace_ops_no_ops)
>       |                               ^
> kernel/trace/ftrace.c:220:14: note: in expansion of macro 'ftrace_ops_list_func'
>   220 |  if (func == ftrace_ops_list_func) {
>       |              ^~~~~~~~~~~~~~~~~~~~
> kernel/trace/ftrace.c: In function 'ftrace_modify_all_code':
> kernel/trace/ftrace.c:128:31: warning: cast between incompatible function types from 'void (*)(long unsigned int,  long unsigned int)' to 'void (*)(long unsigned int,  long unsigned int,  struct ftrace_ops *, struct ftrace_regs *)' [-Wcast-function-type]
>   128 | #define ftrace_ops_list_func ((ftrace_func_t)ftrace_ops_no_ops)
>       |                               ^
> kernel/trace/ftrace.c:2698:35: note: in expansion of macro 'ftrace_ops_list_func'
>  2698 |   err = ftrace_update_ftrace_func(ftrace_ops_list_func);
>       |                                   ^~~~~~~~~~~~~~~~~~~~
> kernel/trace/ftrace.c:128:31: warning: cast between incompatible function types from 'void (*)(long unsigned int,  long unsigned int)' to 'void (*)(long unsigned int,  long unsigned int,  struct ftrace_ops *, struct ftrace_regs *)' [-Wcast-function-type]
>   128 | #define ftrace_ops_list_func ((ftrace_func_t)ftrace_ops_no_ops)
>       |                               ^
> kernel/trace/ftrace.c:2708:41: note: in expansion of macro 'ftrace_ops_list_func'
>  2708 |  if (update && ftrace_trace_function != ftrace_ops_list_func) {
>       |                                         ^~~~~~~~~~~~~~~~~~~~

The above are new to me, thanks for the report, Stephen. I'll address
them. 

> In file included from kernel/bpf/hashtab.c:8:
> kernel/bpf/hashtab.c: In function 'htab_map_gen_lookup':
> include/linux/filter.h:366:4: warning: cast between incompatible function types from 'void * (*)(struct bpf_map *, void *)' 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]
>   366 |   ((u64 (*)(u64, u64, u64, u64, u64))(x))
>       |    ^
> include/linux/filter.h:374:14: note: in definition of macro 'BPF_EMIT_CALL'
>   374 |   .imm   = ((FUNC) - __bpf_call_base) })
>       |              ^~~~
> kernel/bpf/hashtab.c:671:26: note: in expansion of macro 'BPF_CAST_CALL'
>   671 |  *insn++ = BPF_EMIT_CALL(BPF_CAST_CALL(__htab_map_lookup_elem));
>       |                          ^~~~~~~~~~~~~
> kernel/bpf/hashtab.c: In function 'htab_lru_map_gen_lookup':
> include/linux/filter.h:366:4: warning: cast between incompatible function types from 'void * (*)(struct bpf_map *, void *)' 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]
>   366 |   ((u64 (*)(u64, u64, u64, u64, u64))(x))
>       |    ^
> include/linux/filter.h:374:14: note: in definition of macro 'BPF_EMIT_CALL'
>   374 |   .imm   = ((FUNC) - __bpf_call_base) })
>       |              ^~~~
> kernel/bpf/hashtab.c:712:26: note: in expansion of macro 'BPF_CAST_CALL'
>   712 |  *insn++ = BPF_EMIT_CALL(BPF_CAST_CALL(__htab_map_lookup_elem));
>       |                          ^~~~~~~~~~~~~
> kernel/bpf/hashtab.c: In function 'htab_of_map_gen_lookup':
> include/linux/filter.h:366:4: warning: cast between incompatible function types from 'void * (*)(struct bpf_map *, void *)' 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]
>   366 |   ((u64 (*)(u64, u64, u64, u64, u64))(x))
>       |    ^
> include/linux/filter.h:374:14: note: in definition of macro 'BPF_EMIT_CALL'
>   374 |   .imm   = ((FUNC) - __bpf_call_base) })
>       |              ^~~~
> kernel/bpf/hashtab.c:2400:26: note: in expansion of macro 'BPF_CAST_CALL'
>  2400 |  *insn++ = BPF_EMIT_CALL(BPF_CAST_CALL(__htab_map_lookup_elem));
>       |                          ^~~~~~~~~~~~~
> In file included from include/linux/bpf_verifier.h:9,
>                  from kernel/bpf/verifier.c:12:
> kernel/bpf/verifier.c: In function 'jit_subprogs':
> include/linux/filter.h:366: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]
>   366 |   ((u64 (*)(u64, u64, u64, u64, u64))(x))
>       |    ^
> kernel/bpf/verifier.c:12472:16: note: in expansion of macro 'BPF_CAST_CALL'
> 12472 |    insn->imm = BPF_CAST_CALL(func[subprog]->bpf_func) -
>       |                ^~~~~~~~~~~~~
> kernel/bpf/verifier.c: In function 'do_misc_fixups':
> include/linux/filter.h:366:4: warning: cast between incompatible function types from 'void * (* const)(struct bpf_map *, void *)' 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]
>   366 |   ((u64 (*)(u64, u64, u64, u64, u64))(x))
>       |    ^
> kernel/bpf/verifier.c:12953:17: note: in expansion of macro 'BPF_CAST_CALL'
> 12953 |     insn->imm = BPF_CAST_CALL(ops->map_lookup_elem) -
>       |                 ^~~~~~~~~~~~~
> include/linux/filter.h:366:4: warning: cast between incompatible function types from 'int (* const)(struct bpf_map *, void *, void *, u64)' {aka 'int (* const)(struct bpf_map *, void *, void *, long long unsigned int)'} 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]
>   366 |   ((u64 (*)(u64, u64, u64, u64, u64))(x))
>       |    ^
> kernel/bpf/verifier.c:12957:17: note: in expansion of macro 'BPF_CAST_CALL'
> 12957 |     insn->imm = BPF_CAST_CALL(ops->map_update_elem) -
>       |                 ^~~~~~~~~~~~~
> include/linux/filter.h:366:4: warning: cast between incompatible function types from 'int (* const)(struct bpf_map *, void *)' 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]
>   366 |   ((u64 (*)(u64, u64, u64, u64, u64))(x))
>       |    ^
> kernel/bpf/verifier.c:12961:17: note: in expansion of macro 'BPF_CAST_CALL'
> 12961 |     insn->imm = BPF_CAST_CALL(ops->map_delete_elem) -
>       |                 ^~~~~~~~~~~~~
> include/linux/filter.h:366:4: warning: cast between incompatible function types from 'int (* const)(struct bpf_map *, void *, u64)' {aka 'int (* const)(struct bpf_map *, void *, long long unsigned int)'} 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]
>   366 |   ((u64 (*)(u64, u64, u64, u64, u64))(x))
>       |    ^
> kernel/bpf/verifier.c:12965:17: note: in expansion of macro 'BPF_CAST_CALL'
> 12965 |     insn->imm = BPF_CAST_CALL(ops->map_push_elem) -
>       |                 ^~~~~~~~~~~~~
> include/linux/filter.h:366:4: warning: cast between incompatible function types from 'int (* const)(struct bpf_map *, void *)' 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]
>   366 |   ((u64 (*)(u64, u64, u64, u64, u64))(x))
>       |    ^
> kernel/bpf/verifier.c:12969:17: note: in expansion of macro 'BPF_CAST_CALL'
> 12969 |     insn->imm = BPF_CAST_CALL(ops->map_pop_elem) -
>       |                 ^~~~~~~~~~~~~
> include/linux/filter.h:366:4: warning: cast between incompatible function types from 'int (* const)(struct bpf_map *, void *)' 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]
>   366 |   ((u64 (*)(u64, u64, u64, u64, u64))(x))
>       |    ^
> kernel/bpf/verifier.c:12973:17: note: in expansion of macro 'BPF_CAST_CALL'
> 12973 |     insn->imm = BPF_CAST_CALL(ops->map_peek_elem) -
>       |                 ^~~~~~~~~~~~~
> include/linux/filter.h:366:4: warning: cast between incompatible function types from 'int (* const)(struct bpf_map *, u32,  u64)' {aka 'int (* const)(struct bpf_map *, unsigned int,  long long unsigned int)'} 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]
>   366 |   ((u64 (*)(u64, u64, u64, u64, u64))(x))
>       |    ^
> kernel/bpf/verifier.c:12977:17: note: in expansion of macro 'BPF_CAST_CALL'
> 12977 |     insn->imm = BPF_CAST_CALL(ops->map_redirect) -
>       |                 ^~~~~~~~~~~~~

All these are already fixed in bpf-next:

https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=3d717fad5081b8e3bda76d86907fad95398cbde8
https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=102acbacfd9a96d101abd96d1a7a5bf92b7c3e8e

> 
> Introduced by commit
> 
>   ffea83dd8823 ("Makefile: Enable -Wcast-function-type")
> 
> Please either fix all these or revert that commit for now.

Yep; I'll remove the commit and go take a look at ftrace.

Thanks for the report!
--
Gustavo



  reply	other threads:[~2021-09-30  0:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-29 23:53 linux-next: build warning after merge of the kspp-gustavo tree Stephen Rothwell
2021-09-30  0:05 ` Gustavo A. R. Silva [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-11-21 22:50 Stephen Rothwell
2023-11-21 23:19 ` Gustavo A. R. Silva
2023-11-21 22:47 Stephen Rothwell
2023-11-21 23:07 ` Gustavo A. R. Silva
2023-11-21 23:19   ` Stephen Rothwell
2023-11-21 23:23     ` Gustavo A. R. Silva
2021-07-13  0:22 Stephen Rothwell
2021-07-13  1:10 ` Gustavo A. R. Silva
2021-07-13  2:39   ` Gustavo A. R. Silva
2021-06-22 22:39 Stephen Rothwell
2021-06-22 22:46 ` Gustavo A. R. Silva
2021-06-22 23:01   ` Gustavo A. R. Silva
2021-06-23  3:03     ` Stephen Rothwell
2021-06-23 13:14 ` David Sterba
2021-06-23 18:39   ` Gustavo A. R. Silva

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210930000545.GA358523@embeddedor \
    --to=gustavoars@kernel.org \
    --cc=gustavo@embeddedor.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox