arch/s390/include/asm/syscall.h:23 syscall_get_nr() warn: check sign expansion for '-1'
From: Dan Carpenter
Date: Wed Mar 25 2026 - 07:25:55 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: bbeb83d3182abe0d245318e274e8531e5dd7a948
commit: e43b8bb56e537bfc8d9076793091e7679020fc9c entry: Inline syscall_exit_to_user_mode()
config: s390-randconfig-r072-20260325 (https://download.01.org/0day-ci/archive/20260325/202603251953.xOfBpOhW-lkp@xxxxxxxxx/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 054e11d1a17e5ba88bb1a8ef32fad3346e80b186)
smatch: v0.5.0-9004-gb810ac53
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@xxxxxxxxx>
| Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
| Closes: https://lore.kernel.org/r/202603251953.xOfBpOhW-lkp@xxxxxxxxx/
smatch warnings:
arch/s390/include/asm/syscall.h:23 syscall_get_nr() warn: check sign expansion for '-1'
vim +23 arch/s390/include/asm/syscall.h
753c4dd6a2fa2a Martin Schwidefsky 2008-10-10 20 static inline long syscall_get_nr(struct task_struct *task,
753c4dd6a2fa2a Martin Schwidefsky 2008-10-10 21 struct pt_regs *regs)
753c4dd6a2fa2a Martin Schwidefsky 2008-10-10 22 {
d3a73acbc26a4a Martin Schwidefsky 2014-04-15 @23 return test_pt_regs_flag(regs, PIF_SYSCALL) ?
aa33c8cbbae2eb Martin Schwidefsky 2011-12-27 24 (regs->int_code & 0xffff) : -1;
regs->int_code is a u32, so the -1 becomes UINT_MAX where -1 was
obviously intended. Maybe change the function to return int or change
the -1 to -1L?
753c4dd6a2fa2a Martin Schwidefsky 2008-10-10 25 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki