arch/riscv/errata/sifive/errata.c:26:14: warning: result of comparison of constant 9223372036854775815 with expression of type 'unsigned long' is always true

From: kernel test robot
Date: Tue Nov 09 2021 - 22:11:25 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: cb690f5238d71f543f4ce874aa59237cf53a877c
commit: 800149a77c2cb8746a94457939b1ba1e37d2c14e riscv: sifive: Apply errata "cip-453" patch
date: 7 months ago
config: riscv-randconfig-c006-20211109 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project f3798ad5fa845771846599f3c088016e3aef800c)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=800149a77c2cb8746a94457939b1ba1e37d2c14e
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 800149a77c2cb8746a94457939b1ba1e37d2c14e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=riscv

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> arch/riscv/errata/sifive/errata.c:26:14: warning: result of comparison of constant 9223372036854775815 with expression of type 'unsigned long' is always true [-Wtautological-constant-out-of-range-compare]
if (arch_id != 0x8000000000000007 ||
~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~
1 warning generated.


vim +26 arch/riscv/errata/sifive/errata.c

18
19 static bool errata_cip_453_check_func(unsigned long arch_id, unsigned long impid)
20 {
21 /*
22 * Affected cores:
23 * Architecture ID: 0x8000000000000007
24 * Implement ID: 0x20181004 <= impid <= 0x20191105
25 */
> 26 if (arch_id != 0x8000000000000007 ||
27 (impid < 0x20181004 || impid > 0x20191105))
28 return false;
29 return true;
30 }
31

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip