qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: "Dmitry Osipenko" <dmitry.osipenko@collabora.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: qemu-devel@nongnu.org, Helge Konetzka <hk@zapateado.de>,
	Ganapathi Kamath <hgkamath@hotmail.com>
Subject: Re: [PATCH v2] virtio-gpu: Correct virgl_renderer_resource_get_info() error check
Date: Fri, 9 Aug 2024 11:16:06 +0200	[thread overview]
Message-ID: <e7c65f33-2438-4c9b-89f9-b1749868e11e@linaro.org> (raw)
In-Reply-To: <20240129073921.446869-1-dmitry.osipenko@collabora.com>

Hi Dmitry,

On 29/1/24 08:39, Dmitry Osipenko wrote:
> virgl_renderer_resource_get_info() returns errno and not -1 on error.

So basically we were ignoring all errors...

Could some errors just be safely ignored? Because apparently
this patch now gives troubles, see:
https://gitlab.com/qemu-project/qemu/-/issues/2490
Can you help us there?

Regards,

Phil.

> Correct the return-value check.
> 
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
> ---
> 
> v2: - Fixed similar incorrect error-checking in vhost-user-gpu
>      - Added r-b from Marc
> 
>   contrib/vhost-user-gpu/virgl.c | 6 +++---
>   hw/display/virtio-gpu-virgl.c  | 2 +-
>   2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/contrib/vhost-user-gpu/virgl.c b/contrib/vhost-user-gpu/virgl.c
> index d1ccdf7d0668..51da0e3667f9 100644
> --- a/contrib/vhost-user-gpu/virgl.c
> +++ b/contrib/vhost-user-gpu/virgl.c
> @@ -327,7 +327,7 @@ virgl_get_resource_info_modifiers(uint32_t resource_id,
>   #ifdef VIRGL_RENDERER_RESOURCE_INFO_EXT_VERSION
>       struct virgl_renderer_resource_info_ext info_ext;
>       ret = virgl_renderer_resource_get_info_ext(resource_id, &info_ext);
> -    if (ret < 0) {
> +    if (ret) {
>           return ret;
>       }
>   
> @@ -335,7 +335,7 @@ virgl_get_resource_info_modifiers(uint32_t resource_id,
>       *modifiers = info_ext.modifiers;
>   #else
>       ret = virgl_renderer_resource_get_info(resource_id, info);
> -    if (ret < 0) {
> +    if (ret) {
>           return ret;
>       }
>   
> @@ -372,7 +372,7 @@ virgl_cmd_set_scanout(VuGpu *g,
>           uint64_t modifiers = 0;
>           ret = virgl_get_resource_info_modifiers(ss.resource_id, &info,
>                                                   &modifiers);
> -        if (ret == -1) {
> +        if (ret) {
>               g_critical("%s: illegal resource specified %d\n",
>                          __func__, ss.resource_id);
>               cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID;
> diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c
> index 8bb7a2c21fe7..9f34d0e6619c 100644
> --- a/hw/display/virtio-gpu-virgl.c
> +++ b/hw/display/virtio-gpu-virgl.c
> @@ -181,7 +181,7 @@ static void virgl_cmd_set_scanout(VirtIOGPU *g,
>           memset(&info, 0, sizeof(info));
>           ret = virgl_renderer_resource_get_info(ss.resource_id, &info);
>   #endif
> -        if (ret == -1) {
> +        if (ret) {
>               qemu_log_mask(LOG_GUEST_ERROR,
>                             "%s: illegal resource specified %d\n",
>                             __func__, ss.resource_id);



  reply	other threads:[~2024-08-09  9:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-29  7:39 [PATCH v2] virtio-gpu: Correct virgl_renderer_resource_get_info() error check Dmitry Osipenko
2024-08-09  9:16 ` Philippe Mathieu-Daudé [this message]
2024-08-09 13:26   ` Dmitry Osipenko

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=e7c65f33-2438-4c9b-89f9-b1749868e11e@linaro.org \
    --to=philmd@linaro.org \
    --cc=dmitry.osipenko@collabora.com \
    --cc=hgkamath@hotmail.com \
    --cc=hk@zapateado.de \
    --cc=kraxel@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).