CC: [email protected] CC: [email protected] BCC: [email protected] CC: [email protected] TO: Alexandre Ghiti <[email protected]> CC: Palmer Dabbelt <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 2c8c230edab57eae6d2e8df7239ef121a45a1443 commit: e8a62cc26ddf53a3c6ba2a8d33036cf7b84f3923 riscv: Implement sv48 support date: 5 weeks ago :::::: branch date: 7 hours ago :::::: commit date: 5 weeks ago config: riscv-randconfig-c006-20220225 (https://download.01.org/0day-ci/archive/20220227/[email protected]/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e) 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=e8a62cc26ddf53a3c6ba2a8d33036cf7b84f3923 git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout e8a62cc26ddf53a3c6ba2a8d33036cf7b84f3923 # save the config file to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <[email protected]> clang-analyzer warnings: (new ones prefixed by >>) drivers/hwmon/lm75.h:29:12: note: '?' condition is true drivers/hwmon/lm75.h:30:29: note: The result of the left shift is undefined because the left operand is negative return (u16)((ntemp / 500) << 7); ~~~~~~~~~~~~~ ^ Suppressed 2 warnings (2 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. 2 warnings generated. Suppressed 2 warnings (2 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. 5 warnings generated. drivers/media/dvb-frontends/cx24120.c:1225:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores] ret = cx24120_writereg(state, CX24120_REG_CLKDIV, state->dcur.clkdiv); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/media/dvb-frontends/cx24120.c:1225:2: note: Value stored to 'ret' is never read ret = cx24120_writereg(state, CX24120_REG_CLKDIV, state->dcur.clkdiv); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/media/dvb-frontends/cx24120.c:1229:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores] ret = cx24120_writereg(state, CX24120_REG_RATEDIV, ret); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/media/dvb-frontends/cx24120.c:1229:2: note: Value stored to 'ret' is never read ret = cx24120_writereg(state, CX24120_REG_RATEDIV, ret); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/media/dvb-frontends/cx24120.c:1471:24: warning: Value stored to 'state' during its initialization is never read [clang-analyzer-deadcode.DeadStores] struct cx24120_state *state = fe->demodulator_priv; ^~~~~ ~~~~~~~~~~~~~~~~~~~~ drivers/media/dvb-frontends/cx24120.c:1471:24: note: Value stored to 'state' during its initialization is never read struct cx24120_state *state = fe->demodulator_priv; ^~~~~ ~~~~~~~~~~~~~~~~~~~~ Suppressed 2 warnings (2 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. 4 warnings generated. drivers/media/dvb-frontends/si21xx.c:830:2: warning: Value stored to 'status' is never read [clang-analyzer-deadcode.DeadStores] status |= si21_writeregs(state, PLL_DIVISOR_REG, ®s[0], 0x04); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/media/dvb-frontends/si21xx.c:830:2: note: Value stored to 'status' is never read status |= si21_writeregs(state, PLL_DIVISOR_REG, ®s[0], 0x04); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Suppressed 3 warnings (2 in non-user code, 1 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. 2 warnings generated. Suppressed 2 warnings (2 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. 2 warnings generated. Suppressed 2 warnings (2 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. 2 warnings generated. Suppressed 2 warnings (2 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. 2 warnings generated. Suppressed 2 warnings (2 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. 2 warnings generated. Suppressed 2 warnings (2 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. 2 warnings generated. Suppressed 2 warnings (2 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. 2 warnings generated. Suppressed 2 warnings (2 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. 2 warnings generated. Suppressed 2 warnings (2 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. 2 warnings generated. Suppressed 2 warnings (2 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. 3 warnings generated. Suppressed 3 warnings (3 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. 4 warnings generated. block/bfq-wf2q.c:263:7: warning: Access to field 'my_sched_data' results in a dereference of a null pointer (loaded from variable 'entity') [clang-analyzer-core.NullDereference] if (!entity->my_sched_data) ^ block/bfq-wf2q.c:1508:2: note: 'entity' initialized to a null pointer value struct bfq_entity *entity = NULL; ^~~~~~~~~~~~~~~~~~~~~~~~~ block/bfq-wf2q.c:1512:6: note: Assuming the condition is false if (bfq_tot_busy_queues(bfqd) == 0) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ block/bfq-wf2q.c:1512:2: note: Taking false branch if (bfq_tot_busy_queues(bfqd) == 0) ^ block/bfq-wf2q.c:1521:2: note: Loop condition is false. Execution continues on line 1582 for (; sd ; sd = entity->my_sched_data) { ^ block/bfq-wf2q.c:1582:28: note: Passing null pointer value via 1st parameter 'entity' bfqq = bfq_entity_to_bfqq(entity); ^~~~~~ block/bfq-wf2q.c:1582:9: note: Calling 'bfq_entity_to_bfqq' bfqq = bfq_entity_to_bfqq(entity); ^~~~~~~~~~~~~~~~~~~~~~~~~~ block/bfq-wf2q.c:263:7: note: Access to field 'my_sched_data' results in a dereference of a null pointer (loaded from variable 'entity') if (!entity->my_sched_data) ^~~~~~ Suppressed 3 warnings (3 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. 4 warnings generated. Suppressed 4 warnings (3 in non-user code, 1 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. 4 warnings generated. >> arch/riscv/kvm/../../../virt/kvm/kvm_main.c:2961:42: warning: Assigned value >> is garbage or undefined [clang-analyzer-core.uninitialized.Assign] for ( ; start_gfn <= end_gfn; start_gfn += nr_pages_avail) { ^ arch/riscv/kvm/../../../virt/kvm/kvm_main.c:3057:9: note: Calling 'kvm_read_guest_offset_cached' return kvm_read_guest_offset_cached(kvm, ghc, data, 0, len); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/riscv/kvm/../../../virt/kvm/kvm_main.c:3033:9: note: Assuming the condition is false BUG_ON(len + offset > ghc->len); ^ include/asm-generic/bug.h:161:45: note: expanded from macro 'BUG_ON' #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) ^~~~~~~~~ include/linux/compiler.h:78:42: note: expanded from macro 'unlikely' # define unlikely(x) __builtin_expect(!!(x), 0) ^ arch/riscv/kvm/../../../virt/kvm/kvm_main.c:3033:2: note: Taking false branch BUG_ON(len + offset > ghc->len); ^ include/asm-generic/bug.h:161:32: note: expanded from macro 'BUG_ON' #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) ^ arch/riscv/kvm/../../../virt/kvm/kvm_main.c:3033:2: note: Loop condition is false. Exiting loop BUG_ON(len + offset > ghc->len); ^ include/asm-generic/bug.h:161:27: note: expanded from macro 'BUG_ON' #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) ^ arch/riscv/kvm/../../../virt/kvm/kvm_main.c:3035:6: note: Assuming 'slots->generation' is not equal to 'ghc->generation' if (slots->generation != ghc->generation) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/riscv/kvm/../../../virt/kvm/kvm_main.c:3035:2: note: Taking true branch if (slots->generation != ghc->generation) { ^ arch/riscv/kvm/../../../virt/kvm/kvm_main.c:3036:7: note: Calling '__kvm_gfn_to_hva_cache_init' if (__kvm_gfn_to_hva_cache_init(slots, ghc, ghc->gpa, ghc->len)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/riscv/kvm/../../../virt/kvm/kvm_main.c:2947:2: note: 'nr_pages_avail' declared without an initial value gfn_t nr_pages_avail; ^~~~~~~~~~~~~~~~~~~~ arch/riscv/kvm/../../../virt/kvm/kvm_main.c:2952:6: note: Assuming 'start_gfn' is <= 'end_gfn' if (start_gfn > end_gfn) { ^~~~~~~~~~~~~~~~~~~ arch/riscv/kvm/../../../virt/kvm/kvm_main.c:2952:2: note: Taking false branch if (start_gfn > end_gfn) { ^ arch/riscv/kvm/../../../virt/kvm/kvm_main.c:2961:10: note: 'start_gfn' is <= 'end_gfn' for ( ; start_gfn <= end_gfn; start_gfn += nr_pages_avail) { ^~~~~~~~~ arch/riscv/kvm/../../../virt/kvm/kvm_main.c:2961:2: note: Loop condition is true. Entering loop body for ( ; start_gfn <= end_gfn; start_gfn += nr_pages_avail) { ^ arch/riscv/kvm/../../../virt/kvm/kvm_main.c:2963:14: note: Calling 'gfn_to_hva_many' ghc->hva = gfn_to_hva_many(ghc->memslot, start_gfn, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/riscv/kvm/../../../virt/kvm/kvm_main.c:2164:9: note: Calling '__gfn_to_hva_many' return __gfn_to_hva_many(slot, gfn, nr_pages, true); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/riscv/kvm/../../../virt/kvm/kvm_main.c:2149:7: note: 'slot' is non-null if (!slot || slot->flags & KVM_MEMSLOT_INVALID) ^~~~ arch/riscv/kvm/../../../virt/kvm/kvm_main.c:2149:6: note: Left side of '||' is false if (!slot || slot->flags & KVM_MEMSLOT_INVALID) ^ arch/riscv/kvm/../../../virt/kvm/kvm_main.c:2149:15: note: Assuming the condition is false if (!slot || slot->flags & KVM_MEMSLOT_INVALID) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/riscv/kvm/../../../virt/kvm/kvm_main.c:2149:2: note: Taking false branch if (!slot || slot->flags & KVM_MEMSLOT_INVALID) ^ arch/riscv/kvm/../../../virt/kvm/kvm_main.c:2152:6: note: Assuming the condition is true if (memslot_is_readonly(slot) && write) ^~~~~~~~~~~~~~~~~~~~~~~~~ arch/riscv/kvm/../../../virt/kvm/kvm_main.c:2152:6: note: Left side of '&&' is true arch/riscv/kvm/../../../virt/kvm/kvm_main.c:2152:35: note: 'write' is true if (memslot_is_readonly(slot) && write) ^~~~~ arch/riscv/kvm/../../../virt/kvm/kvm_main.c:2152:2: note: Taking true branch if (memslot_is_readonly(slot) && write) ^ arch/riscv/kvm/../../../virt/kvm/kvm_main.c:2153:3: note: Returning without writing to '*nr_pages' return KVM_HVA_ERR_RO_BAD; ^ arch/riscv/kvm/../../../virt/kvm/kvm_main.c:2164:9: note: Returning from '__gfn_to_hva_many' return __gfn_to_hva_many(slot, gfn, nr_pages, true); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/riscv/kvm/../../../virt/kvm/kvm_main.c:2164:2: note: Returning without writing to '*nr_pages' return __gfn_to_hva_many(slot, gfn, nr_pages, true); ^ arch/riscv/kvm/../../../virt/kvm/kvm_main.c:2963:14: note: Returning from 'gfn_to_hva_many' ghc->hva = gfn_to_hva_many(ghc->memslot, start_gfn, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/riscv/kvm/../../../virt/kvm/kvm_main.c:2965:7: note: Calling 'kvm_is_error_hva' if (kvm_is_error_hva(ghc->hva)) ^~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/kvm_host.h:130:9: note: Assuming 'addr' is < field 'page_offset' return addr >= PAGE_OFFSET; ^~~~~~~~~~~~~~~~~~~ include/linux/kvm_host.h:130:2: note: Returning zero, which participates in a condition later return addr >= PAGE_OFFSET; ^~~~~~~~~~~~~~~~~~~~~~~~~~ arch/riscv/kvm/../../../virt/kvm/kvm_main.c:2965:7: note: Returning from 'kvm_is_error_hva' vim +2961 arch/riscv/kvm/../../../virt/kvm/kvm_main.c 8e73485c7959fd Paolo Bonzini 2015-05-17 2938 5a2d4365d2c39e Paolo Bonzini 2017-02-03 2939 static int __kvm_gfn_to_hva_cache_init(struct kvm_memslots *slots, 5a2d4365d2c39e Paolo Bonzini 2017-02-03 2940 struct gfn_to_hva_cache *ghc, 8f964525a121f2 Andrew Honig 2013-03-29 2941 gpa_t gpa, unsigned long len) 49c7754ce57063 Gleb Natapov 2010-10-18 2942 { 49c7754ce57063 Gleb Natapov 2010-10-18 2943 int offset = offset_in_page(gpa); 8f964525a121f2 Andrew Honig 2013-03-29 2944 gfn_t start_gfn = gpa >> PAGE_SHIFT; 8f964525a121f2 Andrew Honig 2013-03-29 2945 gfn_t end_gfn = (gpa + len - 1) >> PAGE_SHIFT; 8f964525a121f2 Andrew Honig 2013-03-29 2946 gfn_t nr_pages_needed = end_gfn - start_gfn + 1; 8f964525a121f2 Andrew Honig 2013-03-29 2947 gfn_t nr_pages_avail; 49c7754ce57063 Gleb Natapov 2010-10-18 2948 6ad1e29fe0aba8 Sean Christopherson 2020-01-09 2949 /* Update ghc->generation before performing any error checks. */ 49c7754ce57063 Gleb Natapov 2010-10-18 2950 ghc->generation = slots->generation; 6ad1e29fe0aba8 Sean Christopherson 2020-01-09 2951 6ad1e29fe0aba8 Sean Christopherson 2020-01-09 2952 if (start_gfn > end_gfn) { f1b9dd5eb86cec Jim Mattson 2018-12-17 2953 ghc->hva = KVM_HVA_ERR_BAD; 6ad1e29fe0aba8 Sean Christopherson 2020-01-09 2954 return -EINVAL; 6ad1e29fe0aba8 Sean Christopherson 2020-01-09 2955 } f1b9dd5eb86cec Jim Mattson 2018-12-17 2956 8f964525a121f2 Andrew Honig 2013-03-29 2957 /* 8f964525a121f2 Andrew Honig 2013-03-29 2958 * If the requested region crosses two memslots, we still 8f964525a121f2 Andrew Honig 2013-03-29 2959 * verify that the entire region is valid here. 8f964525a121f2 Andrew Honig 2013-03-29 2960 */ 6ad1e29fe0aba8 Sean Christopherson 2020-01-09 @2961 for ( ; start_gfn <= end_gfn; start_gfn += nr_pages_avail) { 5a2d4365d2c39e Paolo Bonzini 2017-02-03 2962 ghc->memslot = __gfn_to_memslot(slots, start_gfn); 8f964525a121f2 Andrew Honig 2013-03-29 2963 ghc->hva = gfn_to_hva_many(ghc->memslot, start_gfn, 8f964525a121f2 Andrew Honig 2013-03-29 2964 &nr_pages_avail); 8f964525a121f2 Andrew Honig 2013-03-29 2965 if (kvm_is_error_hva(ghc->hva)) 6ad1e29fe0aba8 Sean Christopherson 2020-01-09 2966 return -EFAULT; 8f964525a121f2 Andrew Honig 2013-03-29 2967 } f1b9dd5eb86cec Jim Mattson 2018-12-17 2968 8f964525a121f2 Andrew Honig 2013-03-29 2969 /* Use the slow path for cross page reads and writes. */ 6ad1e29fe0aba8 Sean Christopherson 2020-01-09 2970 if (nr_pages_needed == 1) f1b9dd5eb86cec Jim Mattson 2018-12-17 2971 ghc->hva += offset; f1b9dd5eb86cec Jim Mattson 2018-12-17 2972 else 8f964525a121f2 Andrew Honig 2013-03-29 2973 ghc->memslot = NULL; f1b9dd5eb86cec Jim Mattson 2018-12-17 2974 6ad1e29fe0aba8 Sean Christopherson 2020-01-09 2975 ghc->gpa = gpa; 6ad1e29fe0aba8 Sean Christopherson 2020-01-09 2976 ghc->len = len; 6ad1e29fe0aba8 Sean Christopherson 2020-01-09 2977 return 0; 49c7754ce57063 Gleb Natapov 2010-10-18 2978 } 5a2d4365d2c39e Paolo Bonzini 2017-02-03 2979 :::::: The code at line 2961 was first introduced by commit :::::: 6ad1e29fe0aba843dfffc714fced0ef6a2e19502 KVM: Clean up __kvm_gfn_to_hva_cache_init() and its callers :::::: TO: Sean Christopherson <[email protected]> :::::: CC: Paolo Bonzini <[email protected]> --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected] _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
