From: "Michael S. Tsirkin" <mst@redhat.com>
To: Alvaro Karsz <alvaro.karsz@solid-run.com>
Cc: Jens Axboe <axboe@kernel.dk>, Paolo Bonzini <pbonzini@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
virtualization@lists.linux-foundation.org
Subject: Re: [PATCH] virtio_blk: add VIRTIO_BLK_F_LIFETIME feature support
Date: Fri, 11 Nov 2022 09:17:00 -0500 [thread overview]
Message-ID: <20221111091556-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CAJs=3_AvDxkY-DZCbRUPw08DsHCoNS6s7cCjcjXMiFkq1K-03w@mail.gmail.com>
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@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2022-11-11 14:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-08 12:53 [PATCH] virtio_blk: add VIRTIO_BLK_F_LIFETIME feature support Alvaro Karsz
2022-11-11 12:20 ` Alvaro Karsz
2022-11-11 14:17 ` Michael S. Tsirkin [this message]
2022-11-11 14:24 ` Michael S. Tsirkin
2022-11-11 15:43 ` Alvaro Karsz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221111091556-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=alvaro.karsz@solid-run.com \
--cc=axboe@kernel.dk \
--cc=pbonzini@redhat.com \
--cc=stefanha@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.