Skip to contentSkip to conversation

ui/pixman: Fix crash in qemu_pixman_shareable_free()

PATCH In review Markus Armbruster 4 participants 10 messages Oct 13, 2025 – Oct 21, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ui/pixman: Fix crash in qemu_pixman_shareable_free()

Fixes b296b29d3414 (ui/pixman: Consistent error handling in qemu_pixman_shareable_free())
---
 ui/qemu-pixman.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
ui/qemu-pixman.c +3 -1
index e46c6232cf..aea09755b9 100644
@@ -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
Signature · 1 line
2.49.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Markus Armbruster
Fixes b296b29d3414 (ui/pixman: Consistent error handling in qemu_pixman_shareable_free())
---
 ui/qemu-pixman.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

With regards,
Daniel

Signature · 3 lines
|: 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 :|
Reviewed-by on v1 1/1
#2 lore raw
In reply to Markus Armbruster
Quoted 12 lines · Markus Armbruster
Fixes b296b29d3414 (ui/pixman: Consistent error handling in qemu_pixman_shareable_free())
---
  ui/qemu-pixman.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
ui/qemu-pixman.c +0 -0
index e46c6232cf..aea09755b9 100644

ui/qemu-pixman.c qemu_pixman_shareable_free(qemu_pixman_shareable handle, · line 293

Quoted 3 lines
ui/qemu-pixman.c +0 -0
@@ -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,

Quoted 7 lines
ui/qemu-pixman.c +3 -1
-    error_report_err(err);
+    if (err) {
+        error_report_err(err);
+    }
  #else
      qemu_memfd_free(ptr, size, handle);
  #endif
#3 lore raw

Am 13. Oktober 2025 14:11:32 UTC schrieb "Philippe Mathieu-Daudé" <[email protected]>:

Quoted 19 lines · Markus Armbruster
Quoted 12 lines
Fixes b296b29d3414 (ui/pixman: Consistent error handling in qemu_pixman_shareable_free())
---
  ui/qemu-pixman.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
ui/qemu-pixman.c +0 -0
index e46c6232cf..aea09755b9 100644

ui/qemu-pixman.c qemu_pixman_shareable_free(qemu_pixman_shareable handle, · line 292

Quoted 2 lines
ui/qemu-pixman.c +0 -0
@@ -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:

Quoted 4 lines

+ * 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

Quoted 12 lines

Anyhow,

Quoted 7 lines
ui/qemu-pixman.c +3 -1
-    error_report_err(err);
+    if (err) {
+        error_report_err(err);
+    }
  #else
      qemu_memfd_free(ptr, size, handle);
  #endif
#4 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 20 lines · Philippe Mathieu-Daudé
Quoted 12 lines · Markus Armbruster
Fixes b296b29d3414 (ui/pixman: Consistent error handling in qemu_pixman_shareable_free())
---
  ui/qemu-pixman.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
ui/qemu-pixman.c +0 -0
index e46c6232cf..aea09755b9 100644

ui/qemu-pixman.c qemu_pixman_shareable_free(qemu_pixman_shareable handle, · line 293

Quoted 3 lines
ui/qemu-pixman.c +0 -0
@@ -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:

Quoted 4 lines

+ * 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.

I went fo a minimal fix.

I now see that this is the only use of qemu_win32_map_free(). Changing it to return bool would've been okay.

Quoted 2 lines

Anyhow,

Thanks!

Quoted 7 lines
Quoted 7 lines
ui/qemu-pixman.c +3 -1
-    error_report_err(err);
+    if (err) {
+        error_report_err(err);
+    }
  #else
      qemu_memfd_free(ptr, size, handle);
  #endif
#5 lore raw
In reply to Markus Armbruster

Am 13. Oktober 2025 11:21:02 UTC schrieb Markus Armbruster <[email protected]>:

Quoted 12 lines
Fixes b296b29d3414 (ui/pixman: Consistent error handling in qemu_pixman_shareable_free())

---
ui/qemu-pixman.c | 4 +++-

1 file changed, 3 insertions(+), 1 deletion(-)
ui/qemu-pixman.c +0 -0
index e46c6232cf..aea09755b9 100644

ui/qemu-pixman.c qemu_pixman_shareable_free(qemu_pixman_shareable handle, · line 299

Quoted 10 lines
ui/qemu-pixman.c +3 -1
@@ -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

Thanks for the quick fix, Markus! The patch is reviewed and I've been testing it for a week. Who is going to merge it?

Best regards,
Bernhard

author Tested-by Bernhard Beschow Reviewed-by Bernhard Beschow
#6 lore raw
Quoted 15 lines · Bernhard Beschow

Am 13. Oktober 2025 11:21:02 UTC schrieb Markus Armbruster <[email protected]>:

Quoted 14 lines
Fixes b296b29d3414 (ui/pixman: Consistent error handling in qemu_pixman_shareable_free())

---
ui/qemu-pixman.c | 4 +++-

1 file changed, 3 insertions(+), 1 deletion(-)
ui/qemu-pixman.c +0 -0
index e46c6232cf..aea09755b9 100644
@@ -291,7 +291,9 @@ qemu_pixman_shareable_free(qemu_pixman_shareable handle,
    Error *err = NULL;
 
Quoted 10 lines

ui/qemu-pixman.c qemu_pixman_shareable_free(qemu_pixman_shareable handle, · line 299

Quoted 8 lines
ui/qemu-pixman.c +3 -1
    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

Thanks for the quick fix, Markus! The patch is reviewed and I've been testing it for a week. Who is going to merge it?

I can do it.

You provided

Tested-by Bernhard Beschow
Reviewed-by Bernhard Beschow

without an e-mail address. Intentional? If not, should I use <[email protected]>?

#7 lore raw

Am 20. Oktober 2025 12:32:33 UTC schrieb Markus Armbruster <[email protected]>:

Quoted 28 lines
Quoted 15 lines · Bernhard Beschow

Am 13. Oktober 2025 11:21:02 UTC schrieb Markus Armbruster <[email protected]>:

Quoted 14 lines
Fixes b296b29d3414 (ui/pixman: Consistent error handling in qemu_pixman_shareable_free())

---
ui/qemu-pixman.c | 4 +++-

1 file changed, 3 insertions(+), 1 deletion(-)
ui/qemu-pixman.c +0 -0
index e46c6232cf..aea09755b9 100644
@@ -291,7 +291,9 @@ qemu_pixman_shareable_free(qemu_pixman_shareable handle,
    Error *err = NULL;
 
Quoted 10 lines

ui/qemu-pixman.c qemu_pixman_shareable_free(qemu_pixman_shareable handle, · line 299

Quoted 8 lines
ui/qemu-pixman.c +3 -1
    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

Thanks for the quick fix, Markus! The patch is reviewed and I've been testing it for a week. Who is going to merge it?

Quoted 8 lines

I can do it.

You provided

Tested-by Bernhard Beschow
Reviewed-by Bernhard Beschow

without an e-mail address. Intentional?

Oh, that wasn't intentional.

Quoted 1 line

If not, should I use <[email protected]>?

Yes, please.

Best regards,
Bernhard

#8 lore raw
Quoted 36 lines · Bernhard Beschow

Am 20. Oktober 2025 12:32:33 UTC schrieb Markus Armbruster <[email protected]>:

Quoted 35 lines
Quoted 15 lines · Bernhard Beschow

Am 13. Oktober 2025 11:21:02 UTC schrieb Markus Armbruster <[email protected]>:

Quoted 14 lines
Fixes b296b29d3414 (ui/pixman: Consistent error handling in qemu_pixman_shareable_free())

---
ui/qemu-pixman.c | 4 +++-

1 file changed, 3 insertions(+), 1 deletion(-)
ui/qemu-pixman.c +0 -0
index e46c6232cf..aea09755b9 100644
@@ -291,7 +291,9 @@ qemu_pixman_shareable_free(qemu_pixman_shareable handle,
    Error *err = NULL;
 
Quoted 10 lines

ui/qemu-pixman.c qemu_pixman_shareable_free(qemu_pixman_shareable handle, · line 299

Quoted 8 lines
ui/qemu-pixman.c +3 -1
    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

Thanks for the quick fix, Markus! The patch is reviewed and I've been testing it for a week. Who is going to merge it?

I can do it.

You provided

Tested-by Bernhard Beschow
Reviewed-by Bernhard Beschow
Quoted 7 lines
Quoted 1 line

without an e-mail address. Intentional?

Oh, that wasn't intentional.

Quoted 1 line

If not, should I use <[email protected]>?

Yes, please.

Done, PR sent. Thank you!

#9 lore raw

Am 21. Oktober 2025 09:50:32 UTC schrieb Markus Armbruster <[email protected]>:

Quoted 40 lines
Quoted 38 lines · Bernhard Beschow

Am 20. Oktober 2025 12:32:33 UTC schrieb Markus Armbruster <[email protected]>:

Quoted 36 lines
Quoted 15 lines · Bernhard Beschow

Am 13. Oktober 2025 11:21:02 UTC schrieb Markus Armbruster <[email protected]>:

Quoted 14 lines
Fixes b296b29d3414 (ui/pixman: Consistent error handling in qemu_pixman_shareable_free())

---
ui/qemu-pixman.c | 4 +++-

1 file changed, 3 insertions(+), 1 deletion(-)
ui/qemu-pixman.c +0 -0
index e46c6232cf..aea09755b9 100644
@@ -291,7 +291,9 @@ qemu_pixman_shareable_free(qemu_pixman_shareable handle,
    Error *err = NULL;
 
Quoted 10 lines

ui/qemu-pixman.c qemu_pixman_shareable_free(qemu_pixman_shareable handle, · line 299

Quoted 8 lines
ui/qemu-pixman.c +3 -1
    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

Thanks for the quick fix, Markus! The patch is reviewed and I've been testing it for a week. Who is going to merge it?

I can do it.

You provided

Tested-by Bernhard Beschow
Reviewed-by Bernhard Beschow

without an e-mail address. Intentional?

Quoted 7 lines
Quoted 5 lines

Oh, that wasn't intentional.

Quoted 1 line

If not, should I use <[email protected]>?

Yes, please.

Done, PR sent. Thank you!

Nice. Thanks!