[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 05/13] ui/console: sanitize search in qemu_graphic_console_is_mult
From: |
marcandre . lureau |
Subject: |
[PULL 05/13] ui/console: sanitize search in qemu_graphic_console_is_multihead() |
Date: |
Tue, 3 Oct 2023 16:35:34 +0400 |
From: Laszlo Ersek <lersek@redhat.com>
qemu_graphic_console_is_multihead() declares the graphical console "c" a
"multihead" console if there are two different graphical consoles in the
system that (a) both reference "c->device", and (b) have different
"c->head" numbers. In effect, if at least two graphical consoles exist
that are different heads of the same device that underlies "c". In fact,
"c" may be one of these two graphical consoles, or "c" may differ from
both of those consoles (in case "c->device" has at least three heads).
The loop currently uses this awkward "two different consoles" approach
because the function used not to have access to "c", only to "c->device",
which didn't allow for fetching (and comparing) "c->head". But, we've
changed that in the last patch; we now pass all of "c" to
qemu_graphic_console_is_multihead().
Thus, look for the *first* (and possibly *only*) graphical console, if
any, that refers to the same "device" as "c", but by a different "head"
number.
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com> (odd fixer:Graphics)
Cc: Gerd Hoffmann <kraxel@redhat.com> (odd fixer:Graphics)
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20230913144959.41891-5-lersek@redhat.com>
---
ui/console.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/ui/console.c b/ui/console.c
index 65463d84a7..8ee66d10c5 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1437,8 +1437,6 @@ bool qemu_console_is_gl_blocked(QemuConsole *con)
static bool qemu_graphic_console_is_multihead(QemuGraphicConsole *c)
{
QemuConsole *con;
- uint32_t f = 0xffffffff;
- uint32_t h;
QTAILQ_FOREACH(con, &consoles, next) {
QemuGraphicConsole *candidate;
@@ -1452,10 +1450,7 @@ static bool
qemu_graphic_console_is_multihead(QemuGraphicConsole *c)
continue;
}
- h = candidate->head;
- if (f == 0xffffffff) {
- f = h;
- } else if (h != f) {
+ if (candidate->head != c->head) {
return true;
}
}
--
2.41.0
- [PULL 00/13] Misc patches, marcandre . lureau, 2023/10/03
- [PULL 01/13] input: Allow to choose console with qemu_input_is_absolute, marcandre . lureau, 2023/10/03
- [PULL 02/13] ui/console: make qemu_console_is_multihead() static, marcandre . lureau, 2023/10/03
- [PULL 04/13] ui/console: eliminate QOM properties from qemu_console_is_multihead(), marcandre . lureau, 2023/10/03
- [PULL 03/13] ui/console: only walk QemuGraphicConsoles in qemu_console_is_multihead(), marcandre . lureau, 2023/10/03
- [PULL 05/13] ui/console: sanitize search in qemu_graphic_console_is_multihead(),
marcandre . lureau <=
- [PULL 07/13] win32: avoid discarding the exception handler, marcandre . lureau, 2023/10/03
- [PULL 06/13] ui: add XBGR8888 and ABGR8888 in drm_format_pixman_map, marcandre . lureau, 2023/10/03
- [PULL 08/13] ui/gtk: fix UI info precondition, marcandre . lureau, 2023/10/03
- [PULL 09/13] analyze-migration: ignore RAM_SAVE_FLAG_MULTIFD_FLUSH, marcandre . lureau, 2023/10/03
- [PULL 10/13] hw/core: remove needless includes, marcandre . lureau, 2023/10/03
- [PULL 13/13] chardev/char-pty: Avoid losing bytes when the other side just (re-)connected, marcandre . lureau, 2023/10/03
- [PULL 11/13] hw/pc: remove needless includes, marcandre . lureau, 2023/10/03
- [PULL 12/13] hw/display/ramfb: plug slight guest-triggerable leak on mode setting, marcandre . lureau, 2023/10/03
- Re: [PULL 00/13] Misc patches, Stefan Hajnoczi, 2023/10/05