QEMU-Arm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-arm] [PATCH] arm: virt: Fix the segmentation fault when specifying an unsupported CPU
@ 2017-01-15 10:51 Shannon Zhao
  2017-01-16 17:27 ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Shannon Zhao @ 2017-01-15 10:51 UTC (permalink / raw)
  To: qemu-arm, peter.maydell; +Cc: qemu-devel, wu.wubin, zhaoshenglong

From: Shannon Zhao <shannon.zhao@linaro.org>

For example, using -cpu generic will cause qemu segmentation fault.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 hw/arm/virt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 7a03f84..4b301c2 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -175,7 +175,7 @@ static bool cpuname_valid(const char *cpu)
     int i;
 
     for (i = 0; i < ARRAY_SIZE(valid_cpus); i++) {
-        if (strcmp(cpu, valid_cpus[i]) == 0) {
+        if (valid_cpus[i] != NULL && strcmp(cpu, valid_cpus[i]) == 0) {
             return true;
         }
     }
-- 
2.0.4



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

end of thread, other threads:[~2017-01-17  1:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-15 10:51 [Qemu-arm] [PATCH] arm: virt: Fix the segmentation fault when specifying an unsupported CPU Shannon Zhao
2017-01-16 17:27 ` Peter Maydell
2017-01-17  1:21   ` Shannon Zhao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox