diff mbox

[kvm-unit-tests,1/3] x86: vm: add assert to avoid multiple vm init

Message ID 1477386030-13955-2-git-send-email-peterx@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Peter Xu Oct. 25, 2016, 9 a.m. UTC
Signed-off-by: Peter Xu <peterx@redhat.com>
---
 lib/x86/vm.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Andrew Jones Oct. 25, 2016, 12:32 p.m. UTC | #1
On Tue, Oct 25, 2016 at 05:00:28PM +0800, Peter Xu wrote:
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>  lib/x86/vm.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/x86/vm.c b/lib/x86/vm.c
> index 906fbf2..f7e778b 100644
> --- a/lib/x86/vm.c
> +++ b/lib/x86/vm.c
> @@ -151,6 +151,7 @@ static void setup_mmu(unsigned long len)
>  
>  void setup_vm()
>  {
> +    assert(!end_of_memory);
>      end_of_memory = fwcfg_get_u64(FW_CFG_RAM_SIZE);
>      free_memory(&edata, end_of_memory - (unsigned long)&edata);
>      setup_mmu(end_of_memory);
> -- 
> 2.7.4
>

Reviewed-by: Andrew Jones <drjones@redhat.com> 
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/lib/x86/vm.c b/lib/x86/vm.c
index 906fbf2..f7e778b 100644
--- a/lib/x86/vm.c
+++ b/lib/x86/vm.c
@@ -151,6 +151,7 @@  static void setup_mmu(unsigned long len)
 
 void setup_vm()
 {
+    assert(!end_of_memory);
     end_of_memory = fwcfg_get_u64(FW_CFG_RAM_SIZE);
     free_memory(&edata, end_of_memory - (unsigned long)&edata);
     setup_mmu(end_of_memory);