From: "Michael S. Tsirkin" <mst@redhat.com>
To: Su Hui <suhui@nfschina.com>
Cc: jasowang@redhat.com, xuanzhuo@linux.alibaba.com,
virtualization@lists.linux-foundation.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] virtio_ring: add an error code check in virtqueue_resize
Date: Fri, 20 Oct 2023 05:34:32 -0400 [thread overview]
Message-ID: <20231020053047-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20231020092320.209234-1-suhui@nfschina.com>
On Fri, Oct 20, 2023 at 05:23:21PM +0800, Su Hui wrote:
> virtqueue_resize_packed() or virtqueue_resize_split() can return
> error code if failed, so add a check for this.
>
> Signed-off-by: Su Hui <suhui@nfschina.com>
> ---
>
> I'm not sure that return directly is right or not,
> maybe there are some process should do before return.
yes - presizely what virtqueue_enable_after_reset does.
Error handling in virtqueue_enable_after_reset is really weird BTW.
For some reason it overrides the error code returned.
> drivers/virtio/virtio_ring.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> index 51d8f3299c10..cf662c3a755b 100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -2759,6 +2759,9 @@ int virtqueue_resize(struct virtqueue *_vq, u32 num,
> else
> err = virtqueue_resize_split(_vq, num);
>
> + if (err)
> + return err;
> +
> return virtqueue_enable_after_reset(_vq);
So I think it should be something like:
int err_reset = virtqueue_enable_after_reset(_vq);
BUG_ON(err_reset);
return err;
> }
> EXPORT_SYMBOL_GPL(virtqueue_resize);
> --
> 2.30.2
WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Su Hui <suhui@nfschina.com>
Cc: xuanzhuo@linux.alibaba.com, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org
Subject: Re: [PATCH] virtio_ring: add an error code check in virtqueue_resize
Date: Fri, 20 Oct 2023 05:34:32 -0400 [thread overview]
Message-ID: <20231020053047-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20231020092320.209234-1-suhui@nfschina.com>
On Fri, Oct 20, 2023 at 05:23:21PM +0800, Su Hui wrote:
> virtqueue_resize_packed() or virtqueue_resize_split() can return
> error code if failed, so add a check for this.
>
> Signed-off-by: Su Hui <suhui@nfschina.com>
> ---
>
> I'm not sure that return directly is right or not,
> maybe there are some process should do before return.
yes - presizely what virtqueue_enable_after_reset does.
Error handling in virtqueue_enable_after_reset is really weird BTW.
For some reason it overrides the error code returned.
> drivers/virtio/virtio_ring.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> index 51d8f3299c10..cf662c3a755b 100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -2759,6 +2759,9 @@ int virtqueue_resize(struct virtqueue *_vq, u32 num,
> else
> err = virtqueue_resize_split(_vq, num);
>
> + if (err)
> + return err;
> +
> return virtqueue_enable_after_reset(_vq);
So I think it should be something like:
int err_reset = virtqueue_enable_after_reset(_vq);
BUG_ON(err_reset);
return err;
> }
> EXPORT_SYMBOL_GPL(virtqueue_resize);
> --
> 2.30.2
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2023-10-20 9:35 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-20 9:23 [PATCH] virtio_ring: add an error code check in virtqueue_resize Su Hui
2023-10-20 9:28 ` Xuan Zhuo
2023-10-20 9:28 ` Xuan Zhuo
2023-10-20 9:34 ` Michael S. Tsirkin [this message]
2023-10-20 9:34 ` Michael S. Tsirkin
2023-10-20 9:36 ` Xuan Zhuo
2023-10-20 9:36 ` Xuan Zhuo
2023-10-20 9:42 ` Michael S. Tsirkin
2023-10-20 9:42 ` Michael S. Tsirkin
2023-10-20 9:50 ` Xuan Zhuo
2023-10-20 9:50 ` Xuan Zhuo
2023-10-20 10:08 ` Michael S. Tsirkin
2023-10-20 10:08 ` Michael S. Tsirkin
2023-10-23 2:26 ` Xuan Zhuo
2023-10-23 2:26 ` Xuan Zhuo
2023-10-23 2:51 ` Su Hui
2023-10-23 2:53 ` Xuan Zhuo
2023-10-23 2:53 ` Xuan Zhuo
2023-10-23 3:06 ` Su Hui
2023-10-23 5:46 ` Xuan Zhuo
2023-10-23 5:46 ` Xuan Zhuo
2023-10-23 9:50 ` Su Hui
2023-10-23 9:52 ` Xuan Zhuo
2023-10-23 9:52 ` Xuan Zhuo
2023-10-23 10:52 ` Xuan Zhuo
2023-10-23 10:52 ` Xuan Zhuo
2023-10-23 11:18 ` Michael S. Tsirkin
2023-10-23 11:18 ` Michael S. Tsirkin
2023-10-23 11:17 ` Michael S. Tsirkin
2023-10-23 11:17 ` Michael S. Tsirkin
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=20231020053047-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=jasowang@redhat.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=suhui@nfschina.com \
--cc=virtualization@lists.linux-foundation.org \
--cc=xuanzhuo@linux.alibaba.com \
/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.