linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [toke:xdp-queueing-03 7/9] net/core/filter.c:9720:14: warning: assignment to 'struct btf *' from 'int' makes pointer from integer without a cast
@ 2022-03-13 22:44 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-03-13 22:44 UTC (permalink / raw)
  To: Kumar Kartikeya Dwivedi
  Cc: kbuild-all, linux-kernel, Toke Høiland-Jørgensen

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/toke/linux.git xdp-queueing-03
head:   3e7f25d58b1bfd5ad623678bf9e11f27c98a8094
commit: 28d9ca982b9ae96bcad2bee81647ba18ae049a69 [7/9] bpf: Enable direct packet access for dequeue packets
config: um-i386_defconfig (https://download.01.org/0day-ci/archive/20220314/202203140612.pwI8TzBG-lkp@intel.com/config)
compiler: gcc-9 (Ubuntu 9.4.0-1ubuntu1~20.04) 9.4.0
reproduce (this is a W=1 build):
        # https://git.kernel.org/pub/scm/linux/kernel/git/toke/linux.git/commit/?id=28d9ca982b9ae96bcad2bee81647ba18ae049a69
        git remote add toke https://git.kernel.org/pub/scm/linux/kernel/git/toke/linux.git
        git fetch --no-tags toke xdp-queueing-03
        git checkout 28d9ca982b9ae96bcad2bee81647ba18ae049a69
        # save the config file to linux build tree
        mkdir build_dir
        make W=1 O=build_dir ARCH=um SUBARCH=i386 SHELL=/bin/bash net/core/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from include/linux/skmsg.h:7,
                    from net/core/filter.c:38:
   include/linux/bpf.h:2062:15: error: return type defaults to 'int' [-Werror=return-type]
    2062 | static inline bpf_get_btf_vmlinux(void)
         |               ^~~~~~~~~~~~~~~~~~~
   include/linux/bpf.h: In function 'bpf_get_btf_vmlinux':
   include/linux/bpf.h:2064:9: warning: returning 'void *' from a function with return type 'int' makes integer from pointer without a cast [-Wint-conversion]
    2064 |  return ERR_PTR(-EINVAL);
         |         ^~~~~~~~~~~~~~~~
   net/core/filter.c: In function 'dequeue_btf_struct_access':
>> net/core/filter.c:9720:14: warning: assignment to 'struct btf *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    9720 |  btf_vmlinux = bpf_get_btf_vmlinux();
         |              ^
   net/core/filter.c: In function 'dequeue_get_convert_ctx_access':
   net/core/filter.c:9848:14: warning: assignment to 'struct btf *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    9848 |  btf_vmlinux = bpf_get_btf_vmlinux();
         |              ^
   cc1: some warnings being treated as errors


vim +9720 net/core/filter.c

  9709	
  9710	static int dequeue_btf_struct_access(struct bpf_verifier_log *log,
  9711					     const struct btf *btf,
  9712					     const struct btf_type *t, int off, int size,
  9713					     enum bpf_access_type atype,
  9714					     u32 *next_btf_id, enum bpf_type_flag *flag)
  9715	{
  9716		const struct btf_type *pkt_type;
  9717		enum bpf_reg_type reg_type;
  9718		struct btf *btf_vmlinux;
  9719	
> 9720		btf_vmlinux = bpf_get_btf_vmlinux();
  9721		if (IS_ERR(btf_vmlinux) || btf != btf_vmlinux)
  9722			return -EINVAL;
  9723	
  9724		if (atype != BPF_READ) {
  9725			bpf_log(log, "only read is supported\n");
  9726			return -EACCES;
  9727		}
  9728	
  9729		pkt_type = btf_type_by_id(btf_vmlinux, xdp_md_btf_ids[0]);
  9730		if (!pkt_type)
  9731			return -EINVAL;
  9732		if (t != pkt_type)
  9733			return btf_struct_access(log, btf, t, off, size, atype,
  9734						 next_btf_id, flag);
  9735	
  9736		switch (off) {
  9737		case offsetof(struct xdp_md, data):
  9738			reg_type = PTR_TO_PACKET;
  9739			break;
  9740		case offsetof(struct xdp_md, data_meta):
  9741			reg_type = PTR_TO_PACKET_META;
  9742			break;
  9743		case offsetof(struct xdp_md, data_end):
  9744			reg_type = PTR_TO_PACKET_END;
  9745			break;
  9746		default:
  9747			bpf_log(log, "only access to data, data_meta, and data_end allowed for xdp_md\n");
  9748			return -EACCES;
  9749		}
  9750	
  9751		if (!__is_valid_xdp_access(off, size)) {
  9752			bpf_log(log, "invalid xdp_md access off=%d size=%d\n", off, size);
  9753			return -EINVAL;
  9754		}
  9755		return reg_type;
  9756	}
  9757	

---
0-DAY CI Kernel Test Service
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-13 22:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-13 22:44 [toke:xdp-queueing-03 7/9] net/core/filter.c:9720:14: warning: assignment to 'struct btf *' from 'int' makes pointer from integer without a cast kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).