Skip to contentSkip to conversation

hw/pflash_cfi01.c

PATCH New Thorsten Zitterell 1 participant 1 message Nov 17, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/pflash_cfi01.c

Patch to catch wrong/unknown command sequences.

Index: hw/pflash_cfi01.c
===================================================================
RCS file: /sources/qemu/qemu/hw/pflash_cfi01.c,v
retrieving revision 1.2

pflash_cfi01.c +6 -1
diff -u -r1.2 pflash_cfi01.c
@@ -353,6 +353,8 @@
 
             pfl->counter--;
             break;
+        default:
+            goto error_flash;            
         }
         return;
     case 3: /* Confirm mode */
@@ -361,11 +363,14 @@
             if (cmd == 0xd0) {
                 pfl->wcycle = 0;
                 pfl->status |= 0x80;
-                break;
             } else {
                 DPRINTF("%s: unknown command for \"write block\"\n", __func__);
                 PFLASH_BUG("Write block confirm");
+                goto reset_flash;
             }
+            break;
+        default:
+            goto error_flash;            
         }
         return;
     default: