All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] vga: avoid crash if no default vga card
@ 2022-05-03  9:17 Guo Zhi
  2022-05-03 15:39 ` Thomas Huth
  0 siblings, 1 reply; 3+ messages in thread
From: Guo Zhi @ 2022-05-03  9:17 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Guo Zhi, qemu-devel

QEMU in some arch will crash when executing -vga help command, because
there is no default vga model.  Add check to this case and avoid crash.

Signed-off-by: Guo Zhi <qtxuning1999@sjtu.edu.cn>
---
 softmmu/vl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/softmmu/vl.c b/softmmu/vl.c
index c2919579fd..a49e29312b 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -977,7 +977,8 @@ static void select_vgahw(const MachineClass *machine_class, const char *p)
 
             if (vga_interface_available(t) && ti->opt_name) {
                 printf("%-20s %s%s\n", ti->opt_name, ti->name ?: "",
-                       g_str_equal(ti->opt_name, def) ? " (default)" : "");
+                        (def && g_str_equal(ti->opt_name, def)) ?
+                        " (default)" : "");
             }
         }
         exit(0);
-- 
2.35.1



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

* Re: [PATCH v1] vga: avoid crash if no default vga card
  2022-05-03  9:17 [PATCH v1] vga: avoid crash if no default vga card Guo Zhi
@ 2022-05-03 15:39 ` Thomas Huth
  2022-06-28  8:48   ` Laurent Vivier
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Huth @ 2022-05-03 15:39 UTC (permalink / raw)
  To: Guo Zhi, qemu-devel; +Cc: Paolo Bonzini, QEMU Trivial, Gerd Hoffmann

On 03/05/2022 11.17, Guo Zhi wrote:
> QEMU in some arch will crash when executing -vga help command, because
> there is no default vga model.  Add check to this case and avoid crash.
> 
> Signed-off-by: Guo Zhi <qtxuning1999@sjtu.edu.cn>
> ---
>   softmmu/vl.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/softmmu/vl.c b/softmmu/vl.c
> index c2919579fd..a49e29312b 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -977,7 +977,8 @@ static void select_vgahw(const MachineClass *machine_class, const char *p)
>   
>               if (vga_interface_available(t) && ti->opt_name) {
>                   printf("%-20s %s%s\n", ti->opt_name, ti->name ?: "",
> -                       g_str_equal(ti->opt_name, def) ? " (default)" : "");
> +                        (def && g_str_equal(ti->opt_name, def)) ?
> +                        " (default)" : "");
>               }
>           }
>           exit(0);

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/978

Reviewed-by: Thomas Huth <thuth@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>



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

* Re: [PATCH v1] vga: avoid crash if no default vga card
  2022-05-03 15:39 ` Thomas Huth
@ 2022-06-28  8:48   ` Laurent Vivier
  0 siblings, 0 replies; 3+ messages in thread
From: Laurent Vivier @ 2022-06-28  8:48 UTC (permalink / raw)
  To: Thomas Huth, Guo Zhi, qemu-devel
  Cc: Paolo Bonzini, QEMU Trivial, Gerd Hoffmann

Le 03/05/2022 à 17:39, Thomas Huth a écrit :
> On 03/05/2022 11.17, Guo Zhi wrote:
>> QEMU in some arch will crash when executing -vga help command, because
>> there is no default vga model.  Add check to this case and avoid crash.
>>
>> Signed-off-by: Guo Zhi <qtxuning1999@sjtu.edu.cn>
>> ---
>>   softmmu/vl.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/softmmu/vl.c b/softmmu/vl.c
>> index c2919579fd..a49e29312b 100644
>> --- a/softmmu/vl.c
>> +++ b/softmmu/vl.c
>> @@ -977,7 +977,8 @@ static void select_vgahw(const MachineClass *machine_class, const char *p)
>>               if (vga_interface_available(t) && ti->opt_name) {
>>                   printf("%-20s %s%s\n", ti->opt_name, ti->name ?: "",
>> -                       g_str_equal(ti->opt_name, def) ? " (default)" : "");
>> +                        (def && g_str_equal(ti->opt_name, def)) ?
>> +                        " (default)" : "");
>>               }
>>           }
>>           exit(0);
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/978
> 
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> Tested-by: Thomas Huth <thuth@redhat.com>
> 
>

Applied to my trivial-patches branch.

Thanks,
Laurent



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

end of thread, other threads:[~2022-06-28  9:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-03  9:17 [PATCH v1] vga: avoid crash if no default vga card Guo Zhi
2022-05-03 15:39 ` Thomas Huth
2022-06-28  8:48   ` Laurent Vivier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.