mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
synced 2026-11-10 20:48:12 +00:00
tools/sched_ext: fix getopt() option variable signedness
Four example schedulers (scx_simple, scx_cpu0, scx_sdt, scx_userland) declare the variable that holds getopt()'s return value as __u32. getopt() returns int and uses -1 to mark end-of-options; storing that sentinel in an unsigned variable turns it into 0xffffffff, and the subsequent 'opt != -1' test only happens to keep working because both operands of != are promoted to the same 0xffffffff. Declare the variable as __s32 instead, matching getopt()'s actual contract and the style already used in scx_qmap.c (int opt) and scx_pair/central/flatcg.c (__s32 opt). This also silences the -Wsign-compare warnings emitted for the affected files. Signed-off-by: Liang Luo <luoliang@kylinos.cn> Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
parent
e2c60e15d0
commit
0cfd929fba
4 changed files with 4 additions and 4 deletions
Loading…
Add table
Add a link
Reference in a new issue