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

[Xen-changelog] [qemu-upstream-unstable] linux-user: Check for cpu_init() errors



commit a958b9be8697dd2316669a83e85c68ccd85bfc49
Author:     Eduardo Habkost <ehabkost@xxxxxxxxxx>
AuthorDate: Tue Feb 3 16:48:51 2015 -0200
Commit:     Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
CommitDate: Sun Mar 8 22:58:13 2015 -0500

    linux-user: Check for cpu_init() errors
    
    This was the only caller of cpu_init() that was not checking for NULL
    yet.
    
    Reviewed-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
    Signed-off-by: Eduardo Habkost <ehabkost@xxxxxxxxxx>
    (cherry picked from commit 696da41b1b741f6056e52c572e05abd790637be1)
    
    Conflicts:
        linux-user/main.c
    
    *removed context dependency on ec53b45
    
    Signed-off-by: Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
---
 linux-user/main.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/linux-user/main.c b/linux-user/main.c
index 5c14c1e..f2cf2b6 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -3435,12 +3435,19 @@ CPUArchState *cpu_copy(CPUArchState *env)
 {
     CPUState *cpu = ENV_GET_CPU(env);
     CPUArchState *new_env = cpu_init(cpu_model);
-    CPUState *new_cpu = ENV_GET_CPU(new_env);
+    CPUState *new_cpu;
 #if defined(TARGET_HAS_ICE)
     CPUBreakpoint *bp;
     CPUWatchpoint *wp;
 #endif
 
+    if (!new_env) {
+        fprintf(stderr, "cpu_copy: Failed to create new CPU\n");
+        exit(1);
+    }
+
+    new_cpu = ENV_GET_CPU(new_env);
+
     /* Reset non arch specific state */
     cpu_reset(new_cpu);
 
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.