summary refs log tree commit diff stats
path: root/include/exec/ram_addr.h
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2016-02-05 14:20:46 +0000
committerPeter Maydell <peter.maydell@linaro.org>2016-02-05 14:20:46 +0000
commitee8e8f92a730afc17ab8be6e86df6b9a23b8ebc6 (patch)
tree1ed2c16f95bcc6d5268afde9ca2a8321930b47a6 /include/exec/ram_addr.h
parentd38ea87ac54af64ef611de434d07c12dc0399216 (diff)
parent15d61692da651fc79b3fc40050b986c5a73055c0 (diff)
downloadfocaccia-qemu-ee8e8f92a730afc17ab8be6e86df6b9a23b8ebc6.tar.gz
focaccia-qemu-ee8e8f92a730afc17ab8be6e86df6b9a23b8ebc6.zip
Merge remote-tracking branch 'remotes/amit-migration/tags/migration-for-2.6-2' into staging
Migration pull req.

Small fixes, nothing major.

# gpg: Signature made Fri 05 Feb 2016 13:51:30 GMT using RSA key ID 854083B6
# gpg: Good signature from "Amit Shah <amit@amitshah.net>"
# gpg:                 aka "Amit Shah <amit@kernel.org>"
# gpg:                 aka "Amit Shah <amitshah@gmx.net>"

* remotes/amit-migration/tags/migration-for-2.6-2:
  migration: fix bad string passed to error_report()
  static checker: e1000-82540em got aliased to e1000
  migration: remove useless code.
  qmp-commands.hx: Document the missing options for migration capability commands
  qmp-commands.hx: Fix the missing options for migration parameters commands
  migration/ram: Fix some helper functions' parameter to use PageSearchStatus
  savevm: Split load vm state function qemu_loadvm_state
  migration: rename 'file' in MigrationState to 'to_dst_file'
  ram: Split host_from_stream_offset() into two helper functions

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include/exec/ram_addr.h')
-rw-r--r--include/exec/ram_addr.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h
index ef1489da77..606e277092 100644
--- a/include/exec/ram_addr.h
+++ b/include/exec/ram_addr.h
@@ -38,10 +38,14 @@ struct RAMBlock {
     int fd;
 };
 
+static inline bool offset_in_ramblock(RAMBlock *b, ram_addr_t offset)
+{
+    return (b && b->host && offset < b->used_length) ? true : false;
+}
+
 static inline void *ramblock_ptr(RAMBlock *block, ram_addr_t offset)
 {
-    assert(offset < block->used_length);
-    assert(block->host);
+    assert(offset_in_ramblock(block, offset));
     return (char *)block->host + offset;
 }