:::::: :::::: Manual check reason: "low confidence static check warning: crypto/asymmetric_keys/selftest.c:186:39: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]" ::::::
CC: l...@lists.linux.dev CC: kbuild-...@lists.01.org BCC: l...@intel.com CC: linux-ker...@vger.kernel.org TO: David Howells <dhowe...@redhat.com> CC: Simo Sorce <s...@redhat.com> CC: Herbert Xu <herb...@gondor.apana.org.au> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 32346491ddf24599decca06190ebca03ff9de7f8 commit: 3cde3174eb910513d32a9ec8a9b95ea59be833df certs: Add FIPS selftests date: 3 weeks ago :::::: branch date: 18 hours ago :::::: commit date: 3 weeks ago config: s390-randconfig-c005-20220710 (https://download.01.org/0day-ci/archive/20220712/202207120035.qijnykqj-...@intel.com/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 6ce63e267aab79ca87bf63453d34dd3909ab978d) 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 s390 cross compiling tool for clang build # apt-get install binutils-s390x-linux-gnu # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3cde3174eb910513d32a9ec8a9b95ea59be833df git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout 3cde3174eb910513d32a9ec8a9b95ea59be833df # save the config file COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390 clang-analyzer If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot <l...@intel.com> clang-analyzer warnings: (new ones prefixed by >>) ^ include/linux/spinlock_api_smp.h:134:44: note: Calling 'do_raw_spin_lock' LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock); ^ include/linux/lockdep.h:477:2: note: expanded from macro 'LOCK_CONTENDED' lock(_lock) ^~~~~~~~~~~ include/linux/spinlock.h:185:2: note: Calling 'arch_spin_lock' arch_spin_lock(&lock->raw_lock); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/s390/include/asm/spinlock.h:66:7: note: Calling 'arch_spin_trylock_once' if (!arch_spin_trylock_once(lp)) ^ include/linux/compiler.h:56:47: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ^~~~ include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ^~~~ arch/s390/include/asm/spinlock.h:61:52: note: Dereference of null pointer return likely(__atomic_cmpxchg_bool(&lp->lock, 0, SPINLOCK_LOCKVAL)); ^ arch/s390/include/asm/spinlock.h:19:26: note: expanded from macro 'SPINLOCK_LOCKVAL' #define SPINLOCK_LOCKVAL (S390_lowcore.spinlock_lockval) ^ include/linux/compiler.h:45:39: note: expanded from macro 'likely' # define likely(x) (__branch_check__(x, 1, __builtin_constant_p(x))) ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:33:34: note: expanded from macro '__branch_check__' ______r = __builtin_expect(!!(x), expect); \ ^ fs/xfs/xfs_aops.c:496:19: warning: Dereference of null pointer [clang-analyzer-core.NullDereference] if (WARN_ON_ONCE(current->journal_info)) ^ arch/s390/include/asm/current.h:17:45: note: expanded from macro 'current' #define current ((struct task_struct *const)S390_lowcore.current_task) ^ arch/s390/include/asm/lowcore.h:213:22: note: expanded from macro 'S390_lowcore' #define S390_lowcore (*((struct lowcore *) 0)) ^ include/asm-generic/bug.h:110:25: note: expanded from macro 'WARN_ON_ONCE' int __ret_warn_on = !!(condition); \ ^ include/linux/compiler.h:56:47: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ^~~~ fs/xfs/xfs_aops.c:496:19: note: Dereference of null pointer if (WARN_ON_ONCE(current->journal_info)) ^ arch/s390/include/asm/current.h:17:45: note: expanded from macro 'current' #define current ((struct task_struct *const)S390_lowcore.current_task) ^ arch/s390/include/asm/lowcore.h:213:22: note: expanded from macro 'S390_lowcore' #define S390_lowcore (*((struct lowcore *) 0)) ^ include/asm-generic/bug.h:110:25: note: expanded from macro 'WARN_ON_ONCE' int __ret_warn_on = !!(condition); \ ^ include/linux/compiler.h:56:47: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ^~~~ include/linux/sched/mm.h:321:23: warning: Dereference of null pointer [clang-analyzer-core.NullDereference] unsigned int flags = current->flags & PF_MEMALLOC_NOFS; ^ arch/s390/include/asm/current.h:17:45: note: expanded from macro 'current' #define current ((struct task_struct *const)S390_lowcore.current_task) ^ arch/s390/include/asm/lowcore.h:213:22: note: expanded from macro 'S390_lowcore' #define S390_lowcore (*((struct lowcore *) 0)) ^ fs/xfs/xfs_aops.c:425:14: note: Calling 'memalloc_nofs_save' nofs_flag = memalloc_nofs_save(); ^~~~~~~~~~~~~~~~~~~~ include/linux/sched/mm.h:321:23: note: Dereference of null pointer unsigned int flags = current->flags & PF_MEMALLOC_NOFS; ^ arch/s390/include/asm/current.h:17:45: note: expanded from macro 'current' #define current ((struct task_struct *const)S390_lowcore.current_task) ^~~~~~~~~~~~~~~~~~~~~~~~~ arch/s390/include/asm/lowcore.h:213:22: note: expanded from macro 'S390_lowcore' #define S390_lowcore (*((struct lowcore *) 0)) ^ Suppressed 47 warnings (47 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 37 warnings generated. crypto/asymmetric_keys/x509_public_key.c:191:6: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] p = memcpy(desc, cert->subject, sulen); ^~~~~~ crypto/asymmetric_keys/x509_public_key.c:191:6: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 p = memcpy(desc, cert->subject, sulen); ^~~~~~ Suppressed 36 warnings (36 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 16 warnings generated. >> crypto/asymmetric_keys/selftest.c:186:39: warning: Dereference of null >> pointer [clang-analyzer-core.NullDereference] GLOBAL_ROOT_UID, GLOBAL_ROOT_GID, current_cred(), ^ include/linux/cred.h:299:28: note: expanded from macro 'current_cred' rcu_dereference_protected(current->cred, 1) ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ arch/s390/include/asm/current.h:17:45: note: expanded from macro 'current' #define current ((struct task_struct *const)S390_lowcore.current_task) ^ arch/s390/include/asm/lowcore.h:213:22: note: expanded from macro 'S390_lowcore' #define S390_lowcore (*((struct lowcore *) 0)) ^ include/linux/rcupdate.h:595:31: note: expanded from macro 'rcu_dereference_protected' __rcu_dereference_protected((p), __UNIQUE_ID(rcu), (c), __rcu) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/rcupdate.h:401:35: note: expanded from macro '__rcu_dereference_protected' ((typeof(*p) __force __kernel *)(p)); \ ^ crypto/asymmetric_keys/selftest.c:183:2: note: Left side of '&&' is true pr_notice("Running certificate verification selftests\n"); ^ include/linux/printk.h:538:2: note: expanded from macro 'pr_notice' printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) ^ include/linux/printk.h:475:26: note: expanded from macro 'printk' #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__) ^ include/linux/printk.h:446:3: note: expanded from macro 'printk_index_wrap' __printk_index_emit(_fmt, NULL, NULL); \ ^ include/linux/printk.h:399:7: note: expanded from macro '__printk_index_emit' if (__builtin_constant_p(_fmt) && __builtin_constant_p(_level)) { \ ^ crypto/asymmetric_keys/selftest.c:183:2: note: '?' condition is true pr_notice("Running certificate verification selftests\n"); ^ include/linux/printk.h:538:2: note: expanded from macro 'pr_notice' printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) ^ include/linux/printk.h:475:26: note: expanded from macro 'printk' #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__) ^ include/linux/printk.h:446:3: note: expanded from macro 'printk_index_wrap' __printk_index_emit(_fmt, NULL, NULL); \ ^ include/linux/printk.h:399:3: note: expanded from macro '__printk_index_emit' if (__builtin_constant_p(_fmt) && __builtin_constant_p(_level)) { \ ^ include/linux/compiler.h:56:28: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ^ include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ^ crypto/asymmetric_keys/selftest.c:183:2: note: Left side of '&&' is true pr_notice("Running certificate verification selftests\n"); ^ include/linux/printk.h:538:2: note: expanded from macro 'pr_notice' printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) ^ include/linux/printk.h:475:26: note: expanded from macro 'printk' #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__) ^ include/linux/printk.h:446:3: note: expanded from macro 'printk_index_wrap' __printk_index_emit(_fmt, NULL, NULL); \ ^ include/linux/printk.h:399:7: note: expanded from macro '__printk_index_emit' if (__builtin_constant_p(_fmt) && __builtin_constant_p(_level)) { \ ^ crypto/asymmetric_keys/selftest.c:183:2: note: Taking true branch pr_notice("Running certificate verification selftests\n"); ^ include/linux/printk.h:538:2: note: expanded from macro 'pr_notice' printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) ^ include/linux/printk.h:475:26: note: expanded from macro 'printk' #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__) ^ include/linux/printk.h:446:3: note: expanded from macro 'printk_index_wrap' __printk_index_emit(_fmt, NULL, NULL); \ ^ include/linux/printk.h:399:3: note: expanded from macro '__printk_index_emit' if (__builtin_constant_p(_fmt) && __builtin_constant_p(_level)) { \ ^ include/linux/compiler.h:56:23: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ^ crypto/asymmetric_keys/selftest.c:183:2: note: '?' condition is true pr_notice("Running certificate verification selftests\n"); ^ include/linux/printk.h:538:2: note: expanded from macro 'pr_notice' printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) ^ include/linux/printk.h:475:26: note: expanded from macro 'printk' #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__) ^ include/linux/printk.h:446:3: note: expanded from macro 'printk_index_wrap' __printk_index_emit(_fmt, NULL, NULL); \ ^ include/linux/printk.h:408:12: note: expanded from macro '__printk_index_emit' .fmt = __builtin_constant_p(_fmt) ? (_fmt) : NULL, \ vim +186 crypto/asymmetric_keys/selftest.c 3cde3174eb9105 David Howells 2022-05-18 177 3cde3174eb9105 David Howells 2022-05-18 178 int __init fips_signature_selftest(void) 3cde3174eb9105 David Howells 2022-05-18 179 { 3cde3174eb9105 David Howells 2022-05-18 180 struct key *keyring; 3cde3174eb9105 David Howells 2022-05-18 181 int ret, i; 3cde3174eb9105 David Howells 2022-05-18 182 3cde3174eb9105 David Howells 2022-05-18 183 pr_notice("Running certificate verification selftests\n"); 3cde3174eb9105 David Howells 2022-05-18 184 3cde3174eb9105 David Howells 2022-05-18 185 keyring = keyring_alloc(".certs_selftest", 3cde3174eb9105 David Howells 2022-05-18 @186 GLOBAL_ROOT_UID, GLOBAL_ROOT_GID, current_cred(), -- 0-DAY CI Kernel Test Service https://01.org/lkp _______________________________________________ kbuild mailing list -- kbuild@lists.01.org To unsubscribe send an email to kbuild-le...@lists.01.org