Hi James,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    
https://github.com/intel-lab-lkp/linux/commits/James-Bottomley/bpf-make-bpf_key-an-opaque-type/20250731-013040
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link:    
https://lore.kernel.org/r/20250730172745.8480-4-James.Bottomley%40HansenPartnership.com
patch subject: [PATCH v2 3/3] bpf: eliminate the allocation of an intermediate 
struct bpf_key
config: i386-randconfig-141-20250803 
(https://download.01.org/0day-ci/archive/20250804/202508040803.nwexqjwe-...@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 
87f0227cb60147a26a1eeb4fb06e3b505e9c7261)

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 <l...@intel.com>
| Reported-by: Dan Carpenter <dan.carpen...@linaro.org>
| Closes: https://lore.kernel.org/r/202508040803.nwexqjwe-...@intel.com/

smatch warnings:
kernel/trace/bpf_trace.c:1364 bpf_verify_pkcs7_signature() warn: impossible 
condition '(key == BUILTIN_KEY) => (0-u32max == u64max)'

vim +1364 kernel/trace/bpf_trace.c

cce4c40b960673 Daniel Xu       2024-06-12  1353  __bpf_kfunc int 
bpf_verify_pkcs7_signature(struct bpf_dynptr *data_p,
cce4c40b960673 Daniel Xu       2024-06-12  1354                                
struct bpf_dynptr *sig_p,
865b0566d8f1a0 Roberto Sassu   2022-09-20  1355                                
struct bpf_key *trusted_keyring)
865b0566d8f1a0 Roberto Sassu   2022-09-20  1356  {
cce4c40b960673 Daniel Xu       2024-06-12  1357         struct bpf_dynptr_kern 
*data_ptr = (struct bpf_dynptr_kern *)data_p;
cce4c40b960673 Daniel Xu       2024-06-12  1358         struct bpf_dynptr_kern 
*sig_ptr = (struct bpf_dynptr_kern *)sig_p;
9cc2aa8d6b5c93 James Bottomley 2025-07-30  1359         struct key *key = 
(struct key *)trusted_keyring;
74523c06ae20b8 Song Liu        2023-11-06  1360         const void *data, *sig;
74523c06ae20b8 Song Liu        2023-11-06  1361         u32 data_len, sig_len;
865b0566d8f1a0 Roberto Sassu   2022-09-20  1362         int ret;
865b0566d8f1a0 Roberto Sassu   2022-09-20  1363  
9cc2aa8d6b5c93 James Bottomley 2025-07-30 @1364         if ((unsigned long)key 
== BUILTIN_KEY)

BUILTIN_KEY should be changed to -1L so that this works on 32bit
systems.

9cc2aa8d6b5c93 James Bottomley 2025-07-30  1365                 key = NULL;
9cc2aa8d6b5c93 James Bottomley 2025-07-30  1366  
9cc2aa8d6b5c93 James Bottomley 2025-07-30  1367         if 
(system_keyring_id_check((unsigned long)key) < 0) {
865b0566d8f1a0 Roberto Sassu   2022-09-20  1368                 /*
865b0566d8f1a0 Roberto Sassu   2022-09-20  1369                  * Do the 
permission check deferred in bpf_lookup_user_key().
865b0566d8f1a0 Roberto Sassu   2022-09-20  1370                  * See 
bpf_lookup_user_key() for more details.
865b0566d8f1a0 Roberto Sassu   2022-09-20  1371                  *
865b0566d8f1a0 Roberto Sassu   2022-09-20  1372                  * A call to 
key_task_permission() here would be redundant, as
865b0566d8f1a0 Roberto Sassu   2022-09-20  1373                  * it is 
already done by keyring_search() called by
865b0566d8f1a0 Roberto Sassu   2022-09-20  1374                  * 
find_asymmetric_key().
865b0566d8f1a0 Roberto Sassu   2022-09-20  1375                  */
9cc2aa8d6b5c93 James Bottomley 2025-07-30  1376                 ret = 
key_validate(key);
865b0566d8f1a0 Roberto Sassu   2022-09-20  1377                 if (ret < 0)
865b0566d8f1a0 Roberto Sassu   2022-09-20  1378                         return 
ret;
865b0566d8f1a0 Roberto Sassu   2022-09-20  1379         }
865b0566d8f1a0 Roberto Sassu   2022-09-20  1380  
74523c06ae20b8 Song Liu        2023-11-06  1381         data_len = 
__bpf_dynptr_size(data_ptr);
74523c06ae20b8 Song Liu        2023-11-06  1382         data = 
__bpf_dynptr_data(data_ptr, data_len);
74523c06ae20b8 Song Liu        2023-11-06  1383         sig_len = 
__bpf_dynptr_size(sig_ptr);
74523c06ae20b8 Song Liu        2023-11-06  1384         sig = 
__bpf_dynptr_data(sig_ptr, sig_len);
74523c06ae20b8 Song Liu        2023-11-06  1385  
9cc2aa8d6b5c93 James Bottomley 2025-07-30  1386         return 
verify_pkcs7_signature(data, data_len, sig, sig_len, key,
865b0566d8f1a0 Roberto Sassu   2022-09-20  1387                                 
      VERIFYING_UNSPECIFIED_SIGNATURE, NULL,
865b0566d8f1a0 Roberto Sassu   2022-09-20  1388                                 
      NULL);
865b0566d8f1a0 Roberto Sassu   2022-09-20  1389  }

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


Reply via email to