Commit 7317b8cad72b39bf06d1ce76e20a92c7ef157ba6

Authored by balrog
1 parent 9596ebb7

Fix a && -> & typo.

Catch wrong/unknown NOR flash command sequences, by Thorsten Zitterell.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3684 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 2 changed files with 7 additions and 2 deletions
hw/pflash_cfi01.c
@@ -353,6 +353,8 @@ static void pflash_write (pflash_t *pfl, target_ulong offset, uint32_t value, @@ -353,6 +353,8 @@ static void pflash_write (pflash_t *pfl, target_ulong offset, uint32_t value,
353 353
354 pfl->counter--; 354 pfl->counter--;
355 break; 355 break;
  356 + default:
  357 + goto error_flash;
356 } 358 }
357 return; 359 return;
358 case 3: /* Confirm mode */ 360 case 3: /* Confirm mode */
@@ -361,11 +363,14 @@ static void pflash_write (pflash_t *pfl, target_ulong offset, uint32_t value, @@ -361,11 +363,14 @@ static void pflash_write (pflash_t *pfl, target_ulong offset, uint32_t value,
361 if (cmd == 0xd0) { 363 if (cmd == 0xd0) {
362 pfl->wcycle = 0; 364 pfl->wcycle = 0;
363 pfl->status |= 0x80; 365 pfl->status |= 0x80;
364 - break;  
365 } else { 366 } else {
366 DPRINTF("%s: unknown command for \"write block\"\n", __func__); 367 DPRINTF("%s: unknown command for \"write block\"\n", __func__);
367 PFLASH_BUG("Write block confirm"); 368 PFLASH_BUG("Write block confirm");
  369 + goto reset_flash;
368 } 370 }
  371 + break;
  372 + default:
  373 + goto error_flash;
369 } 374 }
370 return; 375 return;
371 default: 376 default:
@@ -8269,7 +8269,7 @@ int main(int argc, char **argv) @@ -8269,7 +8269,7 @@ int main(int argc, char **argv)
8269 kqemu_allowed = 0; 8269 kqemu_allowed = 0;
8270 #endif 8270 #endif
8271 linux_boot = (kernel_filename != NULL); 8271 linux_boot = (kernel_filename != NULL);
8272 - net_boot = (boot_devices_bitmap >> ('n' - 'a')) && 0xF; 8272 + net_boot = (boot_devices_bitmap >> ('n' - 'a')) & 0xF;
8273 8273
8274 /* XXX: this should not be: some embedded targets just have flash */ 8274 /* XXX: this should not be: some embedded targets just have flash */
8275 if (!linux_boot && net_boot == 0 && 8275 if (!linux_boot && net_boot == 0 &&