:::::: :::::: Manual check reason: "low confidence static check warning: fs/efivarfs/vars.c:600:2: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]" ::::::
CC: l...@lists.linux.dev CC: kbuild-...@lists.01.org BCC: l...@intel.com CC: linux-ker...@vger.kernel.org TO: Ard Biesheuvel <a...@kernel.org> tree: git://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git for-kernelci head: f51a4cf21aeb5f981799be9ffc2111729dd0f15e commit: f51a4cf21aeb5f981799be9ffc2111729dd0f15e [18/18] efi: vars: move efivar caching layer into efivarfs :::::: branch date: 6 days ago :::::: commit date: 6 days ago config: riscv-randconfig-c006-20220625 compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 42a7ddb428c999229491b0effbb1a4059149fba8) 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-riscv-linux-gnu # https://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git/commit/?id=f51a4cf21aeb5f981799be9ffc2111729dd0f15e git remote add ardb git://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git git fetch --no-tags ardb for-kernelci git checkout f51a4cf21aeb5f981799be9ffc2111729dd0f15e # save the config file COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv 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/build_bug.h:39:58: note: expanded from macro 'BUILD_BUG_ON_MSG' #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ include/linux/compiler_types.h:352:22: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler_types.h:340:23: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler_types.h:332:9: note: expanded from macro '__compiletime_assert' if (!(condition)) \ ^~~~~~~~~ include/linux/sched.h:1661:2: note: Taking false branch BUILD_BUG_ON(1 + ilog2(TASK_REPORT_MAX) != sizeof(state_char) - 1); ^ include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON' BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) ^ include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG' #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^ include/linux/compiler_types.h:352:2: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ include/linux/compiler_types.h:340:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:332:3: note: expanded from macro '__compiletime_assert' if (!(condition)) \ ^ include/linux/sched.h:1661:2: note: Loop condition is false. Exiting loop BUILD_BUG_ON(1 + ilog2(TASK_REPORT_MAX) != sizeof(state_char) - 1); ^ include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON' BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) ^ include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG' #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^ include/linux/compiler_types.h:352:2: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ include/linux/compiler_types.h:340:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:324:2: note: expanded from macro '__compiletime_assert' do { \ ^ include/linux/sched.h:1663:2: note: Undefined or garbage value returned to caller return state_char[state]; ^ ~~~~~~~~~~~~~~~~~ kernel/sched/core.c:4312:2: warning: Call to function 'memset' 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 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] memset(&p->stats, 0, sizeof(p->stats)); ^~~~~~ kernel/sched/core.c:4312:2: note: Call to function 'memset' 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 'memset_s' in case of C11 memset(&p->stats, 0, sizeof(p->stats)); ^~~~~~ kernel/sched/core.c:4551:3: warning: Call to function 'memset' 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 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] memset(&p->sched_info, 0, sizeof(p->sched_info)); ^~~~~~ kernel/sched/core.c:4551:3: note: Call to function 'memset' 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 'memset_s' in case of C11 memset(&p->sched_info, 0, sizeof(p->sched_info)); ^~~~~~ kernel/sched/core.c:5640:16: warning: Value stored to 'preempt_disable_ip' during its initialization is never read [clang-analyzer-deadcode.DeadStores] unsigned long preempt_disable_ip = get_preempt_disable_ip(current); ^~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ kernel/sched/core.c:5640:16: note: Value stored to 'preempt_disable_ip' during its initialization is never read unsigned long preempt_disable_ip = get_preempt_disable_ip(current); ^~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ kernel/sched/core.c:6428:3: warning: Value stored to 'rq' is never read [clang-analyzer-deadcode.DeadStores] rq = context_switch(rq, prev, next, &rf); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ kernel/sched/core.c:6428:3: note: Value stored to 'rq' is never read rq = context_switch(rq, prev, next, &rf); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ kernel/sched/core.c:7677:2: warning: Call to function 'memset' 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 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] memset(attr, 0, sizeof(*attr)); ^~~~~~ kernel/sched/core.c:7677:2: note: Call to function 'memset' 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 'memset_s' in case of C11 memset(attr, 0, sizeof(*attr)); ^~~~~~ kernel/sched/core.c:9545:3: warning: Value stored to 'ptr' is never read [clang-analyzer-deadcode.DeadStores] ptr += nr_cpu_ids * sizeof(void **); ^ kernel/sched/core.c:9545:3: note: Value stored to 'ptr' is never read kernel/sched/core.c:10974:6: warning: Call to function 'sscanf' 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 'sscanf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] if (sscanf(buf, "%20s %llu", tok, periodp) < 1) ^~~~~~ kernel/sched/core.c:10974:6: note: Call to function 'sscanf' 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 'sscanf_s' in case of C11 if (sscanf(buf, "%20s %llu", tok, periodp) < 1) ^~~~~~ kernel/sched/core.c:10979:6: warning: Call to function 'sscanf' 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 'sscanf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] if (sscanf(tok, "%llu", quotap)) ^~~~~~ kernel/sched/core.c:10979:6: note: Call to function 'sscanf' 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 'sscanf_s' in case of C11 if (sscanf(tok, "%llu", quotap)) ^~~~~~ Suppressed 97 warnings (91 in non-user code, 6 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 34 warnings generated. >> fs/efivarfs/vars.c:600:2: warning: Value stored to 'err' is never read >> [clang-analyzer-deadcode.DeadStores] err = __efivar_entry_get(entry, attributes, size, data); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/efivarfs/vars.c:600:2: note: Value stored to 'err' is never read err = __efivar_entry_get(entry, attributes, size, data); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Suppressed 33 warnings (33 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. 29 warnings generated. Suppressed 29 warnings (29 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. 29 warnings generated. Suppressed 29 warnings (29 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. 35 warnings generated. ipc/msg.c:329:3: warning: Call to function 'memset' 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 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] memset(&out, 0, sizeof(out)); ^~~~~~ ipc/msg.c:329:3: note: Call to function 'memset' 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 'memset_s' in case of C11 memset(&out, 0, sizeof(out)); ^~~~~~ ipc/msg.c:491:2: warning: Call to function 'memset' 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 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] memset(msginfo, 0, sizeof(*msginfo)); ^~~~~~ ipc/msg.c:491:2: note: Call to function 'memset' 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 'memset_s' in case of C11 memset(msginfo, 0, sizeof(*msginfo)); ^~~~~~ ipc/msg.c:518:2: warning: Call to function 'memset' 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 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] memset(p, 0, sizeof(*p)); ^~~~~~ ipc/msg.c:518:2: note: Call to function 'memset' 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 'memset_s' in case of C11 memset(p, 0, sizeof(*p)); ^~~~~~ Suppressed 32 warnings (32 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. ipc/sem.c:688:29: warning: Access to field 'sem_num' results in a dereference of a null pointer (loaded from variable 'sop') [clang-analyzer-core.NullDereference] ipc_update_pid(&sma->sems[sop->sem_num].sempid, pid); ^ ipc/sem.c:2341:6: note: Assuming 'ulp' is non-null if (!ulp) ^~~~ ipc/sem.c:2341:2: note: Taking false branch if (!ulp) ^ ipc/sem.c:2345:2: note: Taking false branch if (!refcount_dec_and_test(&ulp->refcnt)) ^ ipc/sem.c:2348:2: note: Loop condition is true. Entering loop body for (;;) { ^ ipc/sem.c:2357:8: note: Left side of '||' is false un = list_entry_rcu(ulp->list_proc.next, ^ include/linux/rculist.h:307:15: note: expanded from macro 'list_entry_rcu' container_of(READ_ONCE(ptr), type, member) ^ include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE' compiletime_assert_rwonce_type(x); \ ^ include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type' compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \ ^ include/linux/compiler_types.h:319:3: note: expanded from macro '__native_word' (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \ ^ ipc/sem.c:2357:8: note: Left side of '||' is false un = list_entry_rcu(ulp->list_proc.next, ^ include/linux/rculist.h:307:15: note: expanded from macro 'list_entry_rcu' container_of(READ_ONCE(ptr), type, member) ^ include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE' compiletime_assert_rwonce_type(x); \ ^ include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type' compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \ ^ include/linux/compiler_types.h:319:3: note: expanded from macro '__native_word' (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \ ^ ipc/sem.c:2357:8: note: Left side of '||' is true un = list_entry_rcu(ulp->list_proc.next, ^ include/linux/rculist.h:307:15: note: expanded from macro 'list_entry_rcu' container_of(READ_ONCE(ptr), type, member) ^ include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE' compiletime_assert_rwonce_type(x); \ ^ include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type' compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \ ^ include/linux/compiler_types.h:320:28: note: expanded from macro '__native_word' sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) ^ ipc/sem.c:2357:8: note: Taking false branch un = list_entry_rcu(ulp->list_proc.next, ^ include/linux/rculist.h:307:15: note: expanded from macro 'list_entry_rcu' container_of(READ_ONCE(ptr), type, member) vim +/err +600 fs/efivarfs/vars.c f51a4cf21aeb5f Ard Biesheuvel 2022-06-20 584 f51a4cf21aeb5f Ard Biesheuvel 2022-06-20 585 /** f51a4cf21aeb5f Ard Biesheuvel 2022-06-20 586 * efivar_entry_get - call get_variable() f51a4cf21aeb5f Ard Biesheuvel 2022-06-20 587 * @entry: read data for this variable f51a4cf21aeb5f Ard Biesheuvel 2022-06-20 588 * @attributes: variable attributes f51a4cf21aeb5f Ard Biesheuvel 2022-06-20 589 * @size: size of @data buffer f51a4cf21aeb5f Ard Biesheuvel 2022-06-20 590 * @data: buffer to store variable data f51a4cf21aeb5f Ard Biesheuvel 2022-06-20 591 */ f51a4cf21aeb5f Ard Biesheuvel 2022-06-20 592 int efivar_entry_get(struct efivar_entry *entry, u32 *attributes, f51a4cf21aeb5f Ard Biesheuvel 2022-06-20 593 unsigned long *size, void *data) f51a4cf21aeb5f Ard Biesheuvel 2022-06-20 594 { f51a4cf21aeb5f Ard Biesheuvel 2022-06-20 595 int err; f51a4cf21aeb5f Ard Biesheuvel 2022-06-20 596 f51a4cf21aeb5f Ard Biesheuvel 2022-06-20 597 err = efivar_lock(); f51a4cf21aeb5f Ard Biesheuvel 2022-06-20 598 if (err) f51a4cf21aeb5f Ard Biesheuvel 2022-06-20 599 return err; f51a4cf21aeb5f Ard Biesheuvel 2022-06-20 @600 err = __efivar_entry_get(entry, attributes, size, data); f51a4cf21aeb5f Ard Biesheuvel 2022-06-20 601 efivar_unlock(); f51a4cf21aeb5f Ard Biesheuvel 2022-06-20 602 f51a4cf21aeb5f Ard Biesheuvel 2022-06-20 603 return 0; f51a4cf21aeb5f Ard Biesheuvel 2022-06-20 604 } f51a4cf21aeb5f Ard Biesheuvel 2022-06-20 605 -- 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