qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 4/4] cpu: verify that block->host is set


From: Michael S. Tsirkin
Subject: [Qemu-devel] [PATCH 4/4] cpu: verify that block->host is set
Date: Wed, 12 Nov 2014 11:44:47 +0200

If it isn't, access at an offset will cause memory corruption.

Signed-off-by: Michael S. Tsirkin <address@hidden>
---
 include/exec/cpu-all.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index 7c3a5e7..62f5581 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -316,6 +316,7 @@ typedef struct RAMBlock {
 static inline void *ramblock_ptr(RAMBlock *block, ram_addr_t offset)
 {
     assert(offset < block->length);
+    assert(block->host);
     return (char *)block->host + offset;
 }
 
-- 
MST




reply via email to

[Prev in Thread] Current Thread [Next in Thread]