diff mbox series

[2/9] console: add check for ui_info pointer

Message ID 20201203110806.13556-3-kraxel@redhat.com (mailing list archive)
State New, archived
Headers show
Series vnc: support some new extensions. | expand

Commit Message

Gerd Hoffmann Dec. 3, 2020, 11:07 a.m. UTC
Verify the hw_ops->ui_info function pointer is non-zero before
calling it.  Can be triggered by qxl which changes hw_ops when
switching between qxl-native and vga-compat modes.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/console.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Marc-André Lureau Dec. 4, 2020, 11:32 a.m. UTC | #1
On Thu, Dec 3, 2020 at 3:08 PM Gerd Hoffmann <kraxel@redhat.com> wrote:

> Verify the hw_ops->ui_info function pointer is non-zero before
> calling it.  Can be triggered by qxl which changes hw_ops when
> switching between qxl-native and vga-compat modes.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  ui/console.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/ui/console.c b/ui/console.c
> index 16b326854080..8930808d0b6d 100644
> --- a/ui/console.c
> +++ b/ui/console.c
> @@ -1539,7 +1539,9 @@ static void dpy_set_ui_info_timer(void *opaque)
>  {
>      QemuConsole *con = opaque;
>
> -    con->hw_ops->ui_info(con->hw, con->head, &con->ui_info);
> +    if (con->hw_ops->ui_info) {
> +        con->hw_ops->ui_info(con->hw, con->head, &con->ui_info);
> +    }
>

That would ignore the last UI info change, right? Is there a place where it
is actually taken care off later? If yes, perhaps worth a comment. If not,
should it reschedule the timer or should there be a warning on the console?

 }
>
>  bool dpy_ui_info_supported(QemuConsole *con)
> --
> 2.27.0
>
>
>
diff mbox series

Patch

diff --git a/ui/console.c b/ui/console.c
index 16b326854080..8930808d0b6d 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1539,7 +1539,9 @@  static void dpy_set_ui_info_timer(void *opaque)
 {
     QemuConsole *con = opaque;
 
-    con->hw_ops->ui_info(con->hw, con->head, &con->ui_info);
+    if (con->hw_ops->ui_info) {
+        con->hw_ops->ui_info(con->hw, con->head, &con->ui_info);
+    }
 }
 
 bool dpy_ui_info_supported(QemuConsole *con)