On Fri, Nov 11, 2022 at 02:20:01PM +0200, Alvaro Karsz wrote: > > + /* The virtio_blk_lifetime struct fields follow virtio spec. > > + * There is no check/decode on values received from the device. > > + * The data is sent as is to the user. > > + */ > > After more thought, I think that the driver should handle the > virtio_blk_lifetime struct endianness. > Something like: > ... > lifetime.pre_eol_info = __le16_to_cpu(lifetime.pre_eol_info); > lifetime. device_lifetime_est_typ_a = __le16_to_cpu(lifetime. > device_lifetime_est_typ_a); > lifetime. device_lifetime_est_typ_b = __le16_to_cpu(lifetime. > device_lifetime_est_typ_b); > > if (copy_to_user((void __user *)arg, (void *)&lifetime, > ... > > What do you think? I think if you are going to pass struct virtio_blk_lifetime to userspace, better pass it as defined in the spec, in LE format. > I'll wait a few days and create a new version. _______________________________________________ Virtualization mailing list Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linuxfoundation.org/mailman/listinfo/virtualization