> +       /* 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'll wait a few days and create a new version.
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Reply via email to