RE: [PATCH v3 2/5] KVM: arm64: Implement vGICv3 distributor and redistributor access from userspace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 Hello!

> > +	mmio.is_write = is_write;
> > +
> > +	if (attr->attr & KVM_DEV_ARM_VGIC_64BIT) {
> > +		u64 __user *uaddr = (u64 __user *)(long)attr->addr;
> > +		__le64 data;
> > +
> > +		if (is_write) {
> > +			u64 reg;
> > +
> > +			if (get_user(reg, uaddr))
> 
> Wouldn't the use of copy_from_user/copy_to_user here make this whole
> switch redundant? Even if not, you could think about moving this logic
> into into vgic_attr_regs_access() and just hardcode "len=4" into GICv2
> accesses.

 No, because endianess conversion is still strongly typed. And this ends up in:

if (is_write) {
	u64 reg;
	__le64 data;

	copy_from_user(&reg, uaddr, mmio.len);

	if (mmio.len == 8)
		data = cpu_to_le64(reg);
	else
		*((__le32 *)&data) = cpu_to_le32(*((__le32 *)&reg);

isn't this even more ugly? Regardless of where it is placed.

Kind regards,
Pavel Fedin
Expert Engineer
Samsung Electronics Research center Russia


_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm



[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux