Hi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on kvm/queue]
[also build test WARNING on kvm/next mst-vhost/linux-next linus/master 
v6.18-rc6 next-20251120]
[cannot apply to kvm/linux-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    
https://github.com/intel-lab-lkp/linux/commits/griffoul-gmail-com/KVM-nVMX-Implement-cache-for-L1-MSR-bitmap/20251119-012332
base:   https://git.kernel.org/pub/scm/virt/kvm/kvm.git queue
patch link:    
https://lore.kernel.org/r/20251118171113.363528-9-griffoul%40gmail.org
patch subject: [PATCH v2 08/10] KVM: x86: Add nested context management
config: i386-randconfig-141-20251120 
(https://download.01.org/0day-ci/archive/20251121/[email protected]/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 
87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20251121/[email protected]/reproduce)

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 <[email protected]>
| Closes: 
https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> arch/x86/kvm/nested.c:133:10: warning: expression which evaluates to zero 
>> treated as a null pointer constant of type 'struct kvm_nested_context *' 
>> [-Wnon-literal-null-conversion]
     133 |                 return false;
         |                        ^~~~~
   1 warning generated.


vim +133 arch/x86/kvm/nested.c

   122  
   123  struct kvm_nested_context *kvm_nested_context_load(struct kvm_vcpu 
*vcpu,
   124                                                     gpa_t gpa)
   125  {
   126          struct kvm_nested_context_table *table;
   127          struct kvm_nested_context *ctx, *new_ctx = NULL;
   128          struct kvm *vm = vcpu->kvm;
   129          bool reset = false;
   130  
   131          table = vcpu->kvm->arch.nested_context_table;
   132          if (WARN_ON_ONCE(!table))
 > 133                  return false;
   134  retry:
   135          spin_lock(&table->lock);
   136          ctx = kvm_nested_context_find(table, vcpu, gpa);
   137          if (!ctx) {
   138                  /* At capacity? Recycle the LRU context */
   139                  if (table->count >= kvm_nested_context_max(vcpu->kvm)) {
   140                          ctx = kvm_nested_context_recycle(table);
   141                          if (unlikely(!ctx))
   142                                  goto finish;
   143  
   144                          kvm_nested_context_insert(table, ctx, gpa);
   145                          ++vm->stat.nested_context_recycle;
   146                          reset = true;
   147  
   148                  } else if (new_ctx) {
   149                          ++table->count;
   150                          ctx = new_ctx;
   151                          kvm_nested_context_insert(table, ctx, gpa);
   152                          new_ctx = NULL;
   153  
   154                  } else {
   155                          /* Allocate a new context without holding the 
lock */
   156                          spin_unlock(&table->lock);
   157                          new_ctx = 
kvm_x86_ops.nested_ops->alloc_context(vcpu);
   158                          if (unlikely(!new_ctx))
   159                                  return NULL;
   160  
   161                          goto retry;
   162                  }
   163          } else
   164                  ++vm->stat.nested_context_reuse;
   165  
   166          ctx->vcpu = vcpu;
   167  finish:
   168          spin_unlock(&table->lock);
   169  
   170          if (new_ctx)
   171                  kvm_x86_ops.nested_ops->free_context(new_ctx);
   172  
   173          if (reset)
   174                  kvm_x86_ops.nested_ops->reset_context(ctx);
   175  
   176          return ctx;
   177  }
   178  

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

Reply via email to