Skip to contentSkip to conversation

[6267] Fix segfault

Qemu-devel Blue Swirl 1 participant 1 message Jan 10, 2009

lore
Share & tools
lore

Blue Swirl

author
#0 lore raw

Revision: 6267

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6267
Author:   blueswir1
Date:     2009-01-10 14:38:00 +0000 (Sat, 10 Jan 2009)

Log Message:
-----------
Fix segfault

Modified Paths:
--------------
trunk/hw/sun4m.c

Modified: trunk/hw/sun4m.c
===================================================================

hw/sun4m.c +9 -6
@@ -533,8 +533,9 @@
     tcx_init(ds, hwdef->tcx_base, phys_ram_base + tcx_offset, tcx_offset,
              hwdef->vram_size, graphic_width, graphic_height, graphic_depth);
 
-    if (nd_table[0].model == NULL
-        || strcmp(nd_table[0].model, "lance") == 0) {
+    if (nd_table[0].model == NULL)
+        nd_table[0].model = "lance";
+    if (strcmp(nd_table[0].model, "lance") == 0) {
         lance_init(&nd_table[0], hwdef->le_base, ledma, *ledma_irq, le_reset);
     } else if (strcmp(nd_table[0].model, "?") == 0) {
         fprintf(stderr, "qemu: Supported NICs: lance\n");
@@ -1325,8 +1326,9 @@
     tcx_init(ds, hwdef->tcx_base, phys_ram_base + tcx_offset, tcx_offset,
              hwdef->vram_size, graphic_width, graphic_height, graphic_depth);
 
-    if (nd_table[0].model == NULL
-        || strcmp(nd_table[0].model, "lance") == 0) {
+    if (nd_table[0].model == NULL)
+        nd_table[0].model = "lance";
+    if (strcmp(nd_table[0].model, "lance") == 0) {
         lance_init(&nd_table[0], hwdef->le_base, ledma, *ledma_irq, le_reset);
     } else if (strcmp(nd_table[0].model, "?") == 0) {
         fprintf(stderr, "qemu: Supported NICs: lance\n");
@@ -1540,8 +1542,9 @@
     tcx_init(ds, hwdef->tcx_base, phys_ram_base + tcx_offset, tcx_offset,
              hwdef->vram_size, graphic_width, graphic_height, graphic_depth);
 
-    if (nd_table[0].model == NULL
-        || strcmp(nd_table[0].model, "lance") == 0) {
+    if (nd_table[0].model == NULL)
+        nd_table[0].model = "lance";
+    if (strcmp(nd_table[0].model, "lance") == 0) {
         lance_init(&nd_table[0], hwdef->le_base, ledma, *ledma_irq, le_reset);
     } else if (strcmp(nd_table[0].model, "?") == 0) {
         fprintf(stderr, "qemu: Supported NICs: lance\n");