From: kernel test robot <lkp@intel.com>
To: Philo Lu <lulie@linux.alibaba.com>, bpf@vger.kernel.org
Cc: oe-kbuild-all@lists.linux.dev, ast@kernel.org,
daniel@iogearbox.net, john.fastabend@gmail.com,
andrii@kernel.org, martin.lau@linux.dev, song@kernel.org,
yonghong.song@linux.dev, kpsingh@kernel.org, sdf@google.com,
haoluo@google.com, jolsa@kernel.org, rostedt@goodmis.org,
mhiramat@kernel.org, mathieu.desnoyers@efficios.com,
linux-trace-kernel@vger.kernel.org, xuanzhuo@linux.alibaba.com,
dust.li@linux.alibaba.com, alibuda@linux.alibaba.com,
guwen@linux.alibaba.com, hengqi@linux.alibaba.com,
shung-hsi.yu@suse.com
Subject: Re: [PATCH bpf-next 1/3] bpf: implement relay map basis
Date: Sat, 23 Dec 2023 08:11:37 +0800 [thread overview]
Message-ID: <202312230850.NQeIZXj6-lkp@intel.com> (raw)
In-Reply-To: <20231222122146.65519-2-lulie@linux.alibaba.com>
Hi Philo,
kernel test robot noticed the following build warnings:
[auto build test WARNING on bpf-next/master]
url: https://github.com/intel-lab-lkp/linux/commits/Philo-Lu/bpf-implement-relay-map-basis/20231222-204545
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link: https://lore.kernel.org/r/20231222122146.65519-2-lulie%40linux.alibaba.com
patch subject: [PATCH bpf-next 1/3] bpf: implement relay map basis
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20231223/202312230850.NQeIZXj6-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231223/202312230850.NQeIZXj6-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312230850.NQeIZXj6-lkp@intel.com/
All warnings (new ones prefixed by >>):
kernel/bpf/relaymap.c: In function 'relay_map_alloc':
>> kernel/bpf/relaymap.c:79:13: warning: the comparison will always evaluate as 'true' for the address of 'map_name' will never be NULL [-Waddress]
79 | if (!attr->map_name || strlen(attr->map_name) == 0)
| ^
In file included from include/linux/bpf.h:7,
from include/linux/filter.h:9,
from kernel/bpf/relaymap.c:3:
include/uapi/linux/bpf.h:1394:25: note: 'map_name' declared here
1394 | char map_name[BPF_OBJ_NAME_LEN];
| ^~~~~~~~
vim +79 kernel/bpf/relaymap.c
43
44 /* bpf_attr is used as follows:
45 * - key size: must be 0
46 * - value size: value will be used as directory name by map_update_elem
47 * (to create relay files). If passed as 0, it will be set to NAME_MAX as
48 * default
49 *
50 * - max_entries: subbuf size
51 * - map_extra: subbuf num, default as 8
52 *
53 * When alloc, we do not set up relay files considering dir_name conflicts.
54 * Instead we use relay_late_setup_files() in map_update_elem(), and thus the
55 * value is used as dir_name, and map->name is used as base_filename.
56 */
57 static struct bpf_map *relay_map_alloc(union bpf_attr *attr)
58 {
59 struct bpf_relay_map *rmap;
60
61 if (unlikely(attr->map_flags & ~RELAY_CREATE_FLAG_MASK))
62 return ERR_PTR(-EINVAL);
63
64 /* key size must be 0 in relay map */
65 if (unlikely(attr->key_size))
66 return ERR_PTR(-EINVAL);
67
68 if (unlikely(attr->value_size > NAME_MAX)) {
69 pr_warn("value_size should be no more than %d\n", NAME_MAX);
70 return ERR_PTR(-EINVAL);
71 } else if (attr->value_size == 0)
72 attr->value_size = NAME_MAX;
73
74 /* set default subbuf num */
75 attr->map_extra = attr->map_extra & UINT_MAX;
76 if (!attr->map_extra)
77 attr->map_extra = 8;
78
> 79 if (!attr->map_name || strlen(attr->map_name) == 0)
80 return ERR_PTR(-EINVAL);
81
82 rmap = bpf_map_area_alloc(sizeof(*rmap), NUMA_NO_NODE);
83 if (!rmap)
84 return ERR_PTR(-ENOMEM);
85
86 bpf_map_init_from_attr(&rmap->map, attr);
87
88 rmap->relay_cb.create_buf_file = create_buf_file_handler;
89 rmap->relay_cb.remove_buf_file = remove_buf_file_handler;
90 if (attr->map_flags & BPF_F_OVERWRITE)
91 rmap->relay_cb.subbuf_start = subbuf_start_overwrite;
92
93 rmap->relay_chan = relay_open(NULL, NULL,
94 attr->max_entries, attr->map_extra,
95 &rmap->relay_cb, NULL);
96 if (!rmap->relay_chan)
97 return ERR_PTR(-EINVAL);
98
99 return &rmap->map;
100 }
101
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next prev parent reply other threads:[~2023-12-23 0:15 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-22 12:21 [PATCH bpf-next 0/3] bpf: introduce BPF_MAP_TYPE_RELAY Philo Lu
2023-12-22 12:21 ` [PATCH bpf-next 1/3] bpf: implement relay map basis Philo Lu
2023-12-22 14:45 ` Jiri Olsa
2023-12-23 2:54 ` Philo Lu
2023-12-22 23:07 ` kernel test robot
2023-12-23 0:11 ` kernel test robot [this message]
2023-12-23 11:22 ` Hou Tao
2023-12-23 13:02 ` Philo Lu
2023-12-25 11:36 ` Philo Lu
2023-12-25 13:06 ` Hou Tao
2023-12-22 12:21 ` [PATCH bpf-next 2/3] bpf: implement map_update_elem to init relay file Philo Lu
2023-12-22 14:45 ` Jiri Olsa
2023-12-23 2:55 ` Philo Lu
2023-12-23 11:28 ` Hou Tao
2023-12-23 13:19 ` Philo Lu
2023-12-22 12:21 ` [PATCH bpf-next 3/3] bpf: introduce bpf_relay_output helper Philo Lu
2023-12-22 14:46 ` Jiri Olsa
2023-12-23 2:56 ` Philo Lu
2023-12-22 14:45 ` [PATCH bpf-next 0/3] bpf: introduce BPF_MAP_TYPE_RELAY Jiri Olsa
2023-12-23 2:57 ` Philo Lu
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=202312230850.NQeIZXj6-lkp@intel.com \
--to=lkp@intel.com \
--cc=alibuda@linux.alibaba.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=dust.li@linux.alibaba.com \
--cc=guwen@linux.alibaba.com \
--cc=haoluo@google.com \
--cc=hengqi@linux.alibaba.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=lulie@linux.alibaba.com \
--cc=martin.lau@linux.dev \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=rostedt@goodmis.org \
--cc=sdf@google.com \
--cc=shung-hsi.yu@suse.com \
--cc=song@kernel.org \
--cc=xuanzhuo@linux.alibaba.com \
--cc=yonghong.song@linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.