drivers/cxl/core/features.c:441 cxlctl_validate_hw_command() warn: always true condition '(scope >= 0) => (0-u32max >= 0)'
From: kernel test robot
Date: Thu Apr 03 2025 - 22:26:38 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 06a22366d6a11ca8ed03c738171822ac9b714cfd
commit: 4d1c09cef2c244bd19467c016a3e56ba28ecc59d cxl: Add support for fwctl RPC command to enable CXL feature commands
date: 2 weeks ago
config: loongarch-randconfig-r071-20250404 (https://download.01.org/0day-ci/archive/20250404/202504041033.2HBboAZR-lkp@xxxxxxxxx/config)
compiler: loongarch64-linux-gcc (GCC) 14.2.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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202504041033.2HBboAZR-lkp@xxxxxxxxx/
smatch warnings:
drivers/cxl/core/features.c:441 cxlctl_validate_hw_command() warn: always true condition '(scope >= 0) => (0-u32max >= 0)'
vim +441 drivers/cxl/core/features.c
429
430 static bool cxlctl_validate_hw_command(struct cxl_features_state *cxlfs,
431 const struct fwctl_rpc_cxl *rpc_in,
432 enum fwctl_rpc_scope scope,
433 u16 opcode)
434 {
435 struct cxl_mailbox *cxl_mbox = &cxlfs->cxlds->cxl_mbox;
436
437 switch (opcode) {
438 case CXL_MBOX_OP_GET_SUPPORTED_FEATURES:
439 if (cxl_mbox->feat_cap < CXL_FEATURES_RO)
440 return false;
> 441 if (scope >= FWCTL_RPC_CONFIGURATION)
442 return true;
443 return false;
444 default:
445 return false;
446 }
447 }
448
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki