From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: kernel/sched/ext.c:5332 scx_alloc_and_add_sched() warn: passing zero to 'ERR_PTR'
Date: Sun, 14 Dec 2025 16:10:10 +0800 [thread overview]
Message-ID: <202512141601.yAXDAeA9-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Tejun Heo <tj@kernel.org>
CC: Andrea Righi <arighi@nvidia.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
commit: c201ea1578d3b9eed29494ba3dc2abbccf62c4c8 sched_ext: Move event_stats_cpu into scx_sched
date: 8 months ago
:::::: branch date: 4 hours ago
:::::: commit date: 8 months ago
config: powerpc64-randconfig-r073-20251213 (https://download.01.org/0day-ci/archive/20251214/202512141601.yAXDAeA9-lkp@intel.com/config)
compiler: powerpc64-linux-gcc (GCC) 13.4.0
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>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202512141601.yAXDAeA9-lkp@intel.com/
smatch warnings:
kernel/sched/ext.c:5332 scx_alloc_and_add_sched() warn: passing zero to 'ERR_PTR'
vim +/ERR_PTR +5332 kernel/sched/ext.c
f0e1a0643a59bf1 Tejun Heo 2024-06-18 5265
d9f754631021802 Tejun Heo 2025-04-29 5266 static struct scx_sched *scx_alloc_and_add_sched(struct sched_ext_ops *ops)
d9f754631021802 Tejun Heo 2025-04-29 5267 {
d9f754631021802 Tejun Heo 2025-04-29 5268 struct scx_sched *sch;
8409b800a0b1f14 Tejun Heo 2025-04-29 5269 int node, ret;
d9f754631021802 Tejun Heo 2025-04-29 5270
d9f754631021802 Tejun Heo 2025-04-29 5271 sch = kzalloc(sizeof(*sch), GFP_KERNEL);
d9f754631021802 Tejun Heo 2025-04-29 5272 if (!sch)
d9f754631021802 Tejun Heo 2025-04-29 5273 return ERR_PTR(-ENOMEM);
d9f754631021802 Tejun Heo 2025-04-29 5274
d9f754631021802 Tejun Heo 2025-04-29 5275 sch->exit_info = alloc_exit_info(ops->exit_dump_len);
d9f754631021802 Tejun Heo 2025-04-29 5276 if (!sch->exit_info) {
d9f754631021802 Tejun Heo 2025-04-29 5277 ret = -ENOMEM;
d9f754631021802 Tejun Heo 2025-04-29 5278 goto err_free_sch;
d9f754631021802 Tejun Heo 2025-04-29 5279 }
d9f754631021802 Tejun Heo 2025-04-29 5280
cdf5a6faa8cf0ef Tejun Heo 2025-04-29 5281 ret = rhashtable_init(&sch->dsq_hash, &dsq_hash_params);
cdf5a6faa8cf0ef Tejun Heo 2025-04-29 5282 if (ret < 0)
cdf5a6faa8cf0ef Tejun Heo 2025-04-29 5283 goto err_free_ei;
cdf5a6faa8cf0ef Tejun Heo 2025-04-29 5284
8409b800a0b1f14 Tejun Heo 2025-04-29 5285 sch->global_dsqs = kcalloc(nr_node_ids, sizeof(sch->global_dsqs[0]),
8409b800a0b1f14 Tejun Heo 2025-04-29 5286 GFP_KERNEL);
8409b800a0b1f14 Tejun Heo 2025-04-29 5287 if (!sch->global_dsqs) {
8409b800a0b1f14 Tejun Heo 2025-04-29 5288 ret = -ENOMEM;
8409b800a0b1f14 Tejun Heo 2025-04-29 5289 goto err_free_hash;
8409b800a0b1f14 Tejun Heo 2025-04-29 5290 }
8409b800a0b1f14 Tejun Heo 2025-04-29 5291
8409b800a0b1f14 Tejun Heo 2025-04-29 5292 for_each_node_state(node, N_POSSIBLE) {
8409b800a0b1f14 Tejun Heo 2025-04-29 5293 struct scx_dispatch_q *dsq;
8409b800a0b1f14 Tejun Heo 2025-04-29 5294
8409b800a0b1f14 Tejun Heo 2025-04-29 5295 dsq = kzalloc_node(sizeof(*dsq), GFP_KERNEL, node);
8409b800a0b1f14 Tejun Heo 2025-04-29 5296 if (!dsq) {
8409b800a0b1f14 Tejun Heo 2025-04-29 5297 ret = -ENOMEM;
8409b800a0b1f14 Tejun Heo 2025-04-29 5298 goto err_free_gdsqs;
8409b800a0b1f14 Tejun Heo 2025-04-29 5299 }
8409b800a0b1f14 Tejun Heo 2025-04-29 5300
8409b800a0b1f14 Tejun Heo 2025-04-29 5301 init_dsq(dsq, SCX_DSQ_GLOBAL);
8409b800a0b1f14 Tejun Heo 2025-04-29 5302 sch->global_dsqs[node] = dsq;
8409b800a0b1f14 Tejun Heo 2025-04-29 5303 }
8409b800a0b1f14 Tejun Heo 2025-04-29 5304
c201ea1578d3b9e Tejun Heo 2025-04-29 5305 sch->event_stats_cpu = alloc_percpu(struct scx_event_stats);
c201ea1578d3b9e Tejun Heo 2025-04-29 5306 if (!sch->event_stats_cpu)
c201ea1578d3b9e Tejun Heo 2025-04-29 5307 goto err_free_gdsqs;
c201ea1578d3b9e Tejun Heo 2025-04-29 5308
d9f754631021802 Tejun Heo 2025-04-29 5309 atomic_set(&sch->exit_kind, SCX_EXIT_NONE);
d9f754631021802 Tejun Heo 2025-04-29 5310 sch->ops = *ops;
d9f754631021802 Tejun Heo 2025-04-29 5311 ops->priv = sch;
d9f754631021802 Tejun Heo 2025-04-29 5312
d9f754631021802 Tejun Heo 2025-04-29 5313 sch->kobj.kset = scx_kset;
d9f754631021802 Tejun Heo 2025-04-29 5314 ret = kobject_init_and_add(&sch->kobj, &scx_ktype, NULL, "root");
d9f754631021802 Tejun Heo 2025-04-29 5315 if (ret < 0)
c201ea1578d3b9e Tejun Heo 2025-04-29 5316 goto err_free_event_stats;
d9f754631021802 Tejun Heo 2025-04-29 5317
d9f754631021802 Tejun Heo 2025-04-29 5318 return sch;
d9f754631021802 Tejun Heo 2025-04-29 5319
c201ea1578d3b9e Tejun Heo 2025-04-29 5320 err_free_event_stats:
c201ea1578d3b9e Tejun Heo 2025-04-29 5321 free_percpu(sch->event_stats_cpu);
8409b800a0b1f14 Tejun Heo 2025-04-29 5322 err_free_gdsqs:
8409b800a0b1f14 Tejun Heo 2025-04-29 5323 for_each_node_state(node, N_POSSIBLE)
8409b800a0b1f14 Tejun Heo 2025-04-29 5324 kfree(sch->global_dsqs[node]);
8409b800a0b1f14 Tejun Heo 2025-04-29 5325 kfree(sch->global_dsqs);
cdf5a6faa8cf0ef Tejun Heo 2025-04-29 5326 err_free_hash:
cdf5a6faa8cf0ef Tejun Heo 2025-04-29 5327 rhashtable_free_and_destroy(&sch->dsq_hash, NULL, NULL);
d9f754631021802 Tejun Heo 2025-04-29 5328 err_free_ei:
d9f754631021802 Tejun Heo 2025-04-29 5329 free_exit_info(sch->exit_info);
d9f754631021802 Tejun Heo 2025-04-29 5330 err_free_sch:
d9f754631021802 Tejun Heo 2025-04-29 5331 kfree(sch);
d9f754631021802 Tejun Heo 2025-04-29 @5332 return ERR_PTR(ret);
d9f754631021802 Tejun Heo 2025-04-29 5333 }
d9f754631021802 Tejun Heo 2025-04-29 5334
:::::: The code at line 5332 was first introduced by commit
:::::: d9f754631021802b3bd3f58781b4c8ff3677b3a8 sched_ext: Factor out scx_alloc_and_add_sched()
:::::: TO: Tejun Heo <tj@kernel.org>
:::::: CC: Tejun Heo <tj@kernel.org>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2025-12-14 8:11 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202512141601.yAXDAeA9-lkp@intel.com \
--to=lkp@intel.com \
--cc=error27@gmail.com \
--cc=oe-kbuild@lists.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.