From: kernel test robot <lkp@intel.com>
To: Pingfan Liu <piliu@redhat.com>, bpf@vger.kernel.org
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
Pingfan Liu <piliu@redhat.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
John Fastabend <john.fastabend@gmail.com>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
Jeremy Linton <jeremy.linton@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>, Ard Biesheuvel <ardb@kernel.org>,
Simon Horman <horms@kernel.org>,
Gerd Hoffmann <kraxel@redhat.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Philipp Rudo <prudo@redhat.com>, Viktor Malik <vmalik@redhat.com>,
Jan Hendrik Farr <kernel@jfarr.cc>, Baoquan He <bhe@redhat.com>,
Dave Young <dyoung@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
Linux Memory Management List <linux-mm@kvack.org>,
kexec@lists.infradead.org, KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>
Subject: Re: [PATCHv3 3/9] bpf: Introduce bpf_copy_to_kernel() to buffer the content from bpf-prog
Date: Thu, 29 May 2025 19:48:17 +0800 [thread overview]
Message-ID: <202505291926.IPUSqCEj-lkp@intel.com> (raw)
In-Reply-To: <20250529041744.16458-4-piliu@redhat.com>
Hi Pingfan,
kernel test robot noticed the following build warnings:
[auto build test WARNING on bpf-next/net]
[also build test WARNING on bpf-next/master bpf/master arm64/for-next/core linus/master v6.15 next-20250529]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Pingfan-Liu/kexec_file-Make-kexec_image_load_default-global-visible/20250529-122124
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git net
patch link: https://lore.kernel.org/r/20250529041744.16458-4-piliu%40redhat.com
patch subject: [PATCHv3 3/9] bpf: Introduce bpf_copy_to_kernel() to buffer the content from bpf-prog
config: riscv-randconfig-001-20250529 (https://download.01.org/0day-ci/archive/20250529/202505291926.IPUSqCEj-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project f819f46284f2a79790038e1f6649172789734ae8)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250529/202505291926.IPUSqCEj-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/202505291926.IPUSqCEj-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> kernel/bpf/helpers_carrier.c:74:17: warning: no previous prototype for function 'bpf_mem_range_result_put' [-Wmissing-prototypes]
74 | __bpf_kfunc int bpf_mem_range_result_put(struct mem_range_result *result)
| ^
kernel/bpf/helpers_carrier.c:74:13: note: declare 'static' if the function is not intended to be used outside of this translation unit
74 | __bpf_kfunc int bpf_mem_range_result_put(struct mem_range_result *result)
| ^
| static
kernel/bpf/helpers_carrier.c:88:7: warning: variable 'kmalloc' set but not used [-Wunused-but-set-variable]
88 | bool kmalloc;
| ^
>> kernel/bpf/helpers_carrier.c:82:17: warning: no previous prototype for function 'bpf_copy_to_kernel' [-Wmissing-prototypes]
82 | __bpf_kfunc int bpf_copy_to_kernel(const char *name, char *buf, int size)
| ^
kernel/bpf/helpers_carrier.c:82:13: note: declare 'static' if the function is not intended to be used outside of this translation unit
82 | __bpf_kfunc int bpf_copy_to_kernel(const char *name, char *buf, int size)
| ^
| static
>> kernel/bpf/helpers_carrier.c:165:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
165 | if (!find_listener(item->str)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~
kernel/bpf/helpers_carrier.c:174:9: note: uninitialized use occurs here
174 | return ret;
| ^~~
kernel/bpf/helpers_carrier.c:165:2: note: remove the 'if' if its condition is always false
165 | if (!find_listener(item->str)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
166 | hash_add(str_listeners, &item->node, hash);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
167 | } else {
| ~~~~~~
kernel/bpf/helpers_carrier.c:149:9: note: initialize the variable 'ret' to silence this warning
149 | int ret;
| ^
| = 0
4 warnings generated.
vim +/bpf_mem_range_result_put +74 kernel/bpf/helpers_carrier.c
73
> 74 __bpf_kfunc int bpf_mem_range_result_put(struct mem_range_result *result)
75 {
76 return mem_range_result_put(result);
77 }
78
79 /*
80 * Cache the content in @buf into kernel
81 */
> 82 __bpf_kfunc int bpf_copy_to_kernel(const char *name, char *buf, int size)
83 {
84 struct mem_range_result *range;
85 struct mem_cgroup *memcg, *old_memcg;
86 struct str_listener *item;
87 resource_handler handler;
88 bool kmalloc;
89 char *kbuf;
90 int id, ret = 0;
91
92 id = srcu_read_lock(&srcu);
93 item = find_listener(name);
94 if (!item) {
95 srcu_read_unlock(&srcu, id);
96 return -EINVAL;
97 }
98 kmalloc = item->kmalloc;
99 handler = item->handler;
100 srcu_read_unlock(&srcu, id);
101 memcg = get_mem_cgroup_from_current();
102 old_memcg = set_active_memcg(memcg);
103 range = kmalloc(sizeof(struct mem_range_result), GFP_KERNEL);
104 if (!range) {
105 pr_err("fail to allocate mem_range_result\n");
106 ret = -ENOMEM;
107 goto err;
108 }
109
110 kref_init(&range->ref);
111 if (item->kmalloc)
112 kbuf = kmalloc(size, GFP_KERNEL | __GFP_ACCOUNT);
113 else
114 kbuf = __vmalloc(size, GFP_KERNEL | __GFP_ACCOUNT);
115 if (!kbuf) {
116 kfree(range);
117 ret = -ENOMEM;
118 goto err;
119 }
120 ret = copy_from_kernel_nofault(kbuf, buf, size);
121 if (unlikely(ret < 0)) {
122 kfree(range);
123 if (item->kmalloc)
124 kfree(kbuf);
125 else
126 vfree(kbuf);
127 ret = -EINVAL;
128 goto err;
129 }
130 range->kmalloc = item->kmalloc;
131 range->buf = kbuf;
132 range->buf_sz = size;
133 range->data_sz = size;
134 range->memcg = memcg;
135 mem_cgroup_tryget(memcg);
136 range->status = 0;
137 ret = handler(name, range);
138 mem_range_result_put(range);
139 err:
140 set_active_memcg(old_memcg);
141 mem_cgroup_put(memcg);
142 return ret;
143 }
144
145 int register_carrier_listener(struct carrier_listener *listener)
146 {
147 struct str_listener *item;
148 unsigned int hash;
149 int ret;
150
151 if (!listener->name)
152 return -EINVAL;
153 item = kmalloc(sizeof(*item), GFP_KERNEL);
154 if (!item)
155 return -ENOMEM;
156 item->str = kstrdup(listener->name, GFP_KERNEL);
157 if (!item->str) {
158 kfree(item);
159 return -ENOMEM;
160 }
161 item->handler = listener->handler;
162 item->kmalloc = listener->kmalloc;
163 hash = jhash(item->str, strlen(item->str), 0);
164 mutex_lock(&str_listeners_mutex);
> 165 if (!find_listener(item->str)) {
166 hash_add(str_listeners, &item->node, hash);
167 } else {
168 kfree(item->str);
169 kfree(item);
170 ret = -EBUSY;
171 }
172 mutex_unlock(&str_listeners_mutex);
173
174 return ret;
175 }
176 EXPORT_SYMBOL(register_carrier_listener);
177
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next prev parent reply other threads:[~2025-05-29 11:49 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-29 4:17 [PATCHv3 0/9] kexec: Use BPF lskel to enable kexec to load PE format boot image Pingfan Liu
2025-05-29 4:17 ` [PATCHv3 1/9] kexec_file: Make kexec_image_load_default global visible Pingfan Liu
2025-05-29 4:17 ` [PATCHv3 2/9] lib/decompress: Keep decompressor when CONFIG_KEXEC_PE_IMAGE Pingfan Liu
2025-05-29 4:17 ` [PATCHv3 3/9] bpf: Introduce bpf_copy_to_kernel() to buffer the content from bpf-prog Pingfan Liu
2025-05-29 11:48 ` kernel test robot [this message]
2025-06-25 18:10 ` Philipp Rudo
2025-05-29 4:17 ` [PATCHv3 4/9] bpf: Introduce decompressor kfunc Pingfan Liu
2025-05-29 12:31 ` kernel test robot
2025-05-29 4:17 ` [PATCHv3 5/9] kexec: Introduce kexec_pe_image to parse and load PE file Pingfan Liu
2025-06-25 18:09 ` Philipp Rudo
2025-06-30 13:45 ` Pingfan Liu
2025-07-02 9:17 ` Philipp Rudo
2025-07-03 1:17 ` Pingfan Liu
2025-05-29 4:17 ` [PATCHv3 6/9] kexec: Integrate with the introduced bpf kfuncs Pingfan Liu
2025-05-29 4:17 ` [PATCHv3 7/9] kexec: Introduce a bpf-prog lskel to parse PE file Pingfan Liu
2025-05-29 4:17 ` [PATCHv3 8/9] kexec: Integrate bpf light skeleton to load zboot image Pingfan Liu
2025-06-25 18:10 ` Philipp Rudo
2025-06-30 12:40 ` Pingfan Liu
2025-05-29 4:17 ` [PATCHv3 9/9] arm64/kexec: Add PE image format support Pingfan Liu
2025-05-29 15:34 ` kernel test robot
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=202505291926.IPUSqCEj-lkp@intel.com \
--to=lkp@intel.com \
--cc=akpm@linux-foundation.org \
--cc=andrii@kernel.org \
--cc=ardb@kernel.org \
--cc=ast@kernel.org \
--cc=bhe@redhat.com \
--cc=bpf@vger.kernel.org \
--cc=catalin.marinas@arm.com \
--cc=daniel@iogearbox.net \
--cc=dyoung@redhat.com \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=horms@kernel.org \
--cc=jeremy.linton@arm.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kernel@jfarr.cc \
--cc=kexec@lists.infradead.org \
--cc=kpsingh@kernel.org \
--cc=kraxel@redhat.com \
--cc=linux-mm@kvack.org \
--cc=llvm@lists.linux.dev \
--cc=martin.lau@linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=piliu@redhat.com \
--cc=prudo@redhat.com \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--cc=vkuznets@redhat.com \
--cc=vmalik@redhat.com \
--cc=will@kernel.org \
--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.