]> Git Repo - qemu.git/commitdiff
hw/onenand: reject read-only drives
authorJuha Riihimäki <[email protected]>
Thu, 20 Oct 2011 12:53:35 +0000 (14:53 +0200)
committerAndrzej Zaborowski <[email protected]>
Mon, 14 Nov 2011 02:22:30 +0000 (03:22 +0100)
Signed-off-by: Juha Riihimäki <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Signed-off-by: Andrzej Zaborowski <[email protected]>
hw/onenand.c

index 6f68f70698b1a057f3eb0349e54a94713e97d3b0..7898da9321b80ca59f8ca266347a89777b87c817 100644 (file)
@@ -26,6 +26,7 @@
 #include "memory.h"
 #include "exec-memory.h"
 #include "sysbus.h"
+#include "qemu-error.h"
 
 /* 11 for 2kB-page OneNAND ("2nd generation") and 10 for 1kB-page chips */
 #define PAGE_SHIFT     11
@@ -772,6 +773,10 @@ static int onenand_initfn(SysBusDevice *dev)
         s->image = memset(g_malloc(size + (size >> 5)),
                           0xff, size + (size >> 5));
     } else {
+        if (bdrv_is_read_only(s->bdrv)) {
+            error_report("Can't use a read-only drive");
+            return -1;
+        }
         s->bdrv_cur = s->bdrv;
     }
     s->otp = memset(g_malloc((64 + 2) << PAGE_SHIFT),
This page took 0.026679 seconds and 4 git commands to generate.