sched_ext: idle: Fix errno loss in scx_idle_init()
Subsystems (2)
PATCH 1/1 sched_ext: idle: Fix errno loss in scx_idle_init()
|| is a boolean operator, any nonzero (error) return short-circuits to 1 rather than the actual errno. The caller in scx_init() logs and propagates this value, so the wrong code reaches upper layers.
Signed-off-by Cheng-Yang Chou <[email protected]>
---scx_cid_kfunc_init() in ext_cid.c already uses the correct pattern.
kernel/sched/ext_idle.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
kernel/sched/ext_idle.c +5 -9
@@ -1509,13 +1509,9 @@ static const struct btf_kfunc_id_set scx_kfunc_set_select_cpu = {int scx_idle_init (void ) { -int ret; - - ret =register_btf_kfunc_id_set (BPF_PROG_TYPE_STRUCT_OPS , &scx_kfunc_set_idle) || -register_btf_kfunc_id_set (BPF_PROG_TYPE_TRACING , &scx_kfunc_set_idle) || -register_btf_kfunc_id_set (BPF_PROG_TYPE_SYSCALL , &scx_kfunc_set_idle) || -register_btf_kfunc_id_set (BPF_PROG_TYPE_STRUCT_OPS , &scx_kfunc_set_select_cpu) || -register_btf_kfunc_id_set (BPF_PROG_TYPE_SYSCALL , &scx_kfunc_set_select_cpu); - -return ret; +return register_btf_kfunc_id_set (BPF_PROG_TYPE_STRUCT_OPS , &scx_kfunc_set_idle) ?: +register_btf_kfunc_id_set (BPF_PROG_TYPE_TRACING , &scx_kfunc_set_idle) ?: +register_btf_kfunc_id_set (BPF_PROG_TYPE_SYSCALL , &scx_kfunc_set_idle) ?: +register_btf_kfunc_id_set (BPF_PROG_TYPE_STRUCT_OPS , &scx_kfunc_set_select_cpu) ?: +register_btf_kfunc_id_set (BPF_PROG_TYPE_SYSCALL , &scx_kfunc_set_select_cpu); }
Signature · 1 line
2.48.1
Hello,
Quoted 3 lines · Cheng-Yang Chou
|| is a boolean operator, any nonzero (error) return short-circuits to 1 rather than the actual errno. The caller in
scx_init()logs and propagates this value, so the wrong code reaches upper layers.
Applied to sched_ext/for-7.2.
Thanks.
Signature · 1 line
tejun