fix qemu_get_cpu(), should return NULL if CPU not found
PATCH 1/1 fix qemu_get_cpu(), should return NULL if CPU not found
commit 55e5c2850 breaks CPU not found return value, and returns CPU corresponding to the last non NULL env.
Fix it by returning CPU only if env is not NULL, otherwise CPU is not found and function should return NULL.
--- exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
exec.c +1 -1
@@ -260,7 +260,7 @@ CPUState *qemu_get_cpu(int index) env = env->next_cpu; } -return cpu; +return env ? cpu :NULL ; }void cpu_exec_init (CPUArchState *env)
Signature · 1 line
1.8.1.4
Andreas Färber
AppliedAm 07.03.2013 19:12, schrieb Igor Mammedov:
Quoted 6 lines
commit
55e5c2850breaks CPU not found return value, and returns CPU corresponding to the last non NULL env.
Fix it by returning CPU only if env is not NULL, otherwise CPU is not found and function should return NULL.Signed-off-by Igor Mammedov <[email protected]>
D'oh, that was exactly the problem in ppc code I tried to fix by using this function! ;-)
Thanks, applied to qom-cpu (with modified commit message):
https://github.com/afaerber/qemu-cpu/commits/qom-cpu
Pull coming up.
Andreas
Quoted 18 lines
--- exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)exec.c +1
-1@@ -260,7 +260,7 @@ CPUState *qemu_get_cpu(int index) env = env->next_cpu; } -return cpu; +return env ? cpu :NULL ; }void cpu_exec_init (CPUArchState *env)
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg