[arm-platforms:kvm-arm64/gicv5-full 79/82] arch/arm64/kvm/vgic/vgic-kvm-device.c:814:15: warning: variable 'addr' set but not used
kernel test robot
lkp at intel.com
Mon Dec 22 11:55:06 PST 2025
tree: https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git kvm-arm64/gicv5-full
head: 1426b88096b597395df4c82f089b87c62bab45da
commit: 68c9d49d6ae8b462ac80a902806969a43ac20de0 [79/82] KVM: arm64: gic-v5: Plumb in has/set/get for sysregs & IRS
config: arm64-randconfig-003-20251222 (https://download.01.org/0day-ci/archive/20251223/202512230356.D7sdAEag-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 11.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251223/202512230356.D7sdAEag-lkp@intel.com/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 <lkp at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512230356.D7sdAEag-lkp@intel.com/
All warnings (new ones prefixed by >>):
arch/arm64/kvm/vgic/vgic-kvm-device.c: In function 'vgic_v5_attr_regs_access':
>> arch/arm64/kvm/vgic/vgic-kvm-device.c:814:15: warning: variable 'addr' set but not used [-Wunused-but-set-variable]
814 | gpa_t addr;
| ^~~~
--
arch/arm64/kvm/vgic/vgic-irs-v5.c: In function 'vgic_v5_has_attr_regs':
>> arch/arm64/kvm/vgic/vgic-irs-v5.c:988:15: warning: variable 'addr' set but not used [-Wunused-but-set-variable]
988 | gpa_t addr, offset;
| ^~~~
vim +/addr +814 arch/arm64/kvm/vgic/vgic-kvm-device.c
801
802 /*
803 * vgic_v5_attr_regs_access - allows user space to access VGIC v5 state
804 *
805 * @dev: kvm device handle
806 * @attr: kvm device attribute
807 * @is_write: true if userspace is writing a register
808 */
809 static int vgic_v5_attr_regs_access(struct kvm_device *dev,
810 struct kvm_device_attr *attr,
811 bool is_write)
812 {
813 struct vgic_reg_attr reg_attr;
> 814 gpa_t addr;
815 struct kvm_vcpu *vcpu;
816 bool uaccess;
817 u64 val;
818 int ret;
819
820 ret = vgic_v5_parse_attr(dev, attr, ®_attr);
821 if (ret)
822 return ret;
823
824 vcpu = reg_attr.vcpu;
825 addr = reg_attr.addr;
826
827 switch (attr->group) {
828 case KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS:
829 /* Sysregs uaccess is performed by the sysreg handling code */
830 uaccess = false;
831 break;
832 case KVM_DEV_ARM_VGIC_GRP_IRS_REGS: fallthrough;
833 default:
834 uaccess = true;
835 }
836
837 if (uaccess && is_write) {
838 u64 __user *uaddr = (u64 __user *)(unsigned long)attr->addr;
839 if (get_user(val, uaddr))
840 return -EFAULT;
841 }
842
843 mutex_lock(&dev->kvm->lock);
844
845 if (kvm_trylock_all_vcpus(dev->kvm)) {
846 mutex_unlock(&dev->kvm->lock);
847 return -EBUSY;
848 }
849
850 mutex_lock(&dev->kvm->arch.config_lock);
851
852 if (!(vgic_initialized(dev->kvm) || v5_reg_allowed_pre_init(attr))) {
853 ret = -EBUSY;
854 goto out;
855 }
856
857 switch (attr->group) {
858 case KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS:
859 ret = vgic_v5_cpu_sysregs_uaccess(vcpu, attr, is_write);
860 break;
861 case KVM_DEV_ARM_VGIC_GRP_IRS_REGS:
862 ret = vgic_v5_irs_attr_regs_access(dev, attr, &val, is_write);
863 break;
864 default:
865 ret = -EINVAL;
866 break;
867 }
868
869 out:
870 mutex_unlock(&dev->kvm->arch.config_lock);
871 kvm_unlock_all_vcpus(dev->kvm);
872 mutex_unlock(&dev->kvm->lock);
873
874 if (!ret && uaccess && !is_write) {
875 u64 __user *uaddr = (u64 __user *)(unsigned long)attr->addr;
876 ret = put_user(val, uaddr);
877 }
878
879 return ret;
880 }
881
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
More information about the linux-arm-kernel
mailing list