qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ui/pixman: Fix crash in qemu_pixman_shareable_free()
@ 2025-10-13 11:21 Markus Armbruster
  2025-10-13 11:51 ` Daniel P. Berrangé
  2025-10-13 14:11 ` Philippe Mathieu-Daudé
  0 siblings, 2 replies; 4+ messages in thread
From: Markus Armbruster @ 2025-10-13 11:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcandre.lureau, Bernhard Beschow

Reported-by: Bernhard Beschow <shentey@gmail.com>
Fixes: b296b29d3414 (ui/pixman: Consistent error handling in qemu_pixman_shareable_free())
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 ui/qemu-pixman.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ui/qemu-pixman.c b/ui/qemu-pixman.c
index e46c6232cf..aea09755b9 100644
--- a/ui/qemu-pixman.c
+++ b/ui/qemu-pixman.c
@@ -291,7 +291,9 @@ qemu_pixman_shareable_free(qemu_pixman_shareable handle,
     Error *err = NULL;
 
     qemu_win32_map_free(ptr, handle, &err);
-    error_report_err(err);
+    if (err) {
+        error_report_err(err);
+    }
 #else
     qemu_memfd_free(ptr, size, handle);
 #endif
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ui/pixman: Fix crash in qemu_pixman_shareable_free()
  2025-10-13 11:21 [PATCH] ui/pixman: Fix crash in qemu_pixman_shareable_free() Markus Armbruster
@ 2025-10-13 11:51 ` Daniel P. Berrangé
  2025-10-13 14:11 ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 4+ messages in thread
From: Daniel P. Berrangé @ 2025-10-13 11:51 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel, marcandre.lureau, Bernhard Beschow

On Mon, Oct 13, 2025 at 01:21:02PM +0200, Markus Armbruster wrote:
> Reported-by: Bernhard Beschow <shentey@gmail.com>
> Fixes: b296b29d3414 (ui/pixman: Consistent error handling in qemu_pixman_shareable_free())
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  ui/qemu-pixman.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ui/pixman: Fix crash in qemu_pixman_shareable_free()
  2025-10-13 11:21 [PATCH] ui/pixman: Fix crash in qemu_pixman_shareable_free() Markus Armbruster
  2025-10-13 11:51 ` Daniel P. Berrangé
@ 2025-10-13 14:11 ` Philippe Mathieu-Daudé
  2025-10-13 19:12   ` Bernhard Beschow
  1 sibling, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-13 14:11 UTC (permalink / raw)
  To: Markus Armbruster, qemu-devel; +Cc: marcandre.lureau, Bernhard Beschow

On 13/10/25 13:21, Markus Armbruster wrote:
> Reported-by: Bernhard Beschow <shentey@gmail.com>
> Fixes: b296b29d3414 (ui/pixman: Consistent error handling in qemu_pixman_shareable_free())
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>   ui/qemu-pixman.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/ui/qemu-pixman.c b/ui/qemu-pixman.c
> index e46c6232cf..aea09755b9 100644
> --- a/ui/qemu-pixman.c
> +++ b/ui/qemu-pixman.c
> @@ -291,7 +291,9 @@ qemu_pixman_shareable_free(qemu_pixman_shareable handle,
>       Error *err = NULL;
>   
>       qemu_win32_map_free(ptr, handle, &err);

Slightly better if qemu_win32_map_free(), as per commit e3fe3988d78
("error: Document Error API usage rules") recommended style:

+ *  We recommend
+ *   • bool-valued functions return true on success / false on failure,
+ *   • pointer-valued functions return non-null / null pointer, and
+ *   • integer-valued functions return non-negative / negative.

Anyhow,
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

> -    error_report_err(err);
> +    if (err) {
> +        error_report_err(err);
> +    }
>   #else
>       qemu_memfd_free(ptr, size, handle);
>   #endif



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ui/pixman: Fix crash in qemu_pixman_shareable_free()
  2025-10-13 14:11 ` Philippe Mathieu-Daudé
@ 2025-10-13 19:12   ` Bernhard Beschow
  0 siblings, 0 replies; 4+ messages in thread
From: Bernhard Beschow @ 2025-10-13 19:12 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Markus Armbruster, qemu-devel
  Cc: marcandre.lureau



Am 13. Oktober 2025 14:11:32 UTC schrieb "Philippe Mathieu-Daudé" <philmd@linaro.org>:
>On 13/10/25 13:21, Markus Armbruster wrote:
>> Reported-by: Bernhard Beschow <shentey@gmail.com>
>> Fixes: b296b29d3414 (ui/pixman: Consistent error handling in qemu_pixman_shareable_free())
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>>   ui/qemu-pixman.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>> 
>> diff --git a/ui/qemu-pixman.c b/ui/qemu-pixman.c
>> index e46c6232cf..aea09755b9 100644
>> --- a/ui/qemu-pixman.c
>> +++ b/ui/qemu-pixman.c
>> @@ -291,7 +291,9 @@ qemu_pixman_shareable_free(qemu_pixman_shareable handle,
>>       Error *err = NULL;
>>         qemu_win32_map_free(ptr, handle, &err);
>
>Slightly better if qemu_win32_map_free(), as per commit e3fe3988d78
>("error: Document Error API usage rules") recommended style:
>
>+ *  We recommend
>+ *   • bool-valued functions return true on success / false on failure,
>+ *   • pointer-valued functions return non-null / null pointer, and
>+ *   • integer-valued functions return non-negative / negative.

Now I see: Since qemu_win32_map_free() returns void, the pattern is to check for the error pointer. Could be mentioned in the commit message for educational porposes.

Anyhow,
Tested-by: Bernhard Beschow
Reviewed-by: Bernhard Beschow

>
>Anyhow,
>Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>
>> -    error_report_err(err);
>> +    if (err) {
>> +        error_report_err(err);
>> +    }
>>   #else
>>       qemu_memfd_free(ptr, size, handle);
>>   #endif
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-10-13 19:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-13 11:21 [PATCH] ui/pixman: Fix crash in qemu_pixman_shareable_free() Markus Armbruster
2025-10-13 11:51 ` Daniel P. Berrangé
2025-10-13 14:11 ` Philippe Mathieu-Daudé
2025-10-13 19:12   ` Bernhard Beschow

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).