[arm-platforms:kvm-arm64/gicv5-full 62/82] arch/arm64/kvm/vgic/vgic-v5.c:896:2-7: WARNING: NULL check before some freeing functions is not needed.

kernel test robot lkp at intel.com
Tue Dec 23 02:03:30 PST 2025


tree:   https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git kvm-arm64/gicv5-full
head:   1426b88096b597395df4c82f089b87c62bab45da
commit: 9c3aa62ac1b11cec38e958d7f7bf033bf308902d [62/82] KVM: arm64: gic-v5: Add IRS init/teardown to vgic_v5 init/teardown
config: arm64-randconfig-r064-20251223 (https://download.01.org/0day-ci/archive/20251223/202512231705.sZJLmMXm-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 15.1.0

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 <lkp at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512231705.sZJLmMXm-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> arch/arm64/kvm/vgic/vgic-v5.c:896:2-7: WARNING: NULL check before some freeing functions is not needed.

vim +896 arch/arm64/kvm/vgic/vgic-v5.c

   858	
   859	void vgic_v5_teardown(struct kvm *kvm)
   860	{
   861		struct kvm_vcpu *vcpu, *vcpu0;
   862		struct vgic_dist *dist = &kvm->arch.vgic;
   863		unsigned long i;
   864		int rc;
   865	
   866		/*
   867		 * There's a chance we don't have CPUs yet, in which case we've also not
   868		 * initialised the tables.
   869		 */
   870		if (!atomic_read(&kvm->online_vcpus))
   871			goto out_no_vcpus;
   872	
   873		/* Make the VM invalid  */
   874		vcpu0 = kvm_get_vcpu(kvm, 0);
   875		rc = vgic_v5_send_command(vcpu0, VMTE_MAKE_INVALID);
   876		if (rc)
   877			kvm_err("could not make VMTE invalid\n");
   878	
   879		kvm_for_each_vcpu(i, vcpu, kvm) {
   880			/* Goodbye doorbell */
   881			vgic_v5_disable_vcpu(vcpu);
   882	
   883			if (vgic_v5_vmte_free_vpe(vcpu))
   884				kvm_err("Failed to free VPE\n");
   885		}
   886	
   887		vgic_v5_teardown_per_vm_domain(&kvm->arch.vgic.gicv5_vm);
   888	
   889		if (vgic_v5_vmte_release(kvm))
   890			kvm_err("Failed to release VM 0x%x\n", dist->gicv5_vm.vm_id);
   891	
   892		vgic_v5_release_vm_id(kvm);
   893	
   894	out_no_vcpus:
   895		if (dist->vgic_v5_irs_data)
 > 896			kfree(dist->vgic_v5_irs_data);
   897		dist->vgic_v5_irs_data = NULL;
   898	}
   899	

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



More information about the linux-arm-kernel mailing list