All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] fix qemu_get_cpu(), should return NULL if CPU not found
@ 2013-03-07 18:12 Igor Mammedov
  2013-03-12  9:42 ` Andreas Färber
  0 siblings, 1 reply; 2+ messages in thread
From: Igor Mammedov @ 2013-03-07 18:12 UTC (permalink / raw)
  To: qemu-devel; +Cc: afaerber

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.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 exec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/exec.c b/exec.c
index 46a2830..0a96ddb 100644
--- a/exec.c
+++ b/exec.c
@@ -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)
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-12  9:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-07 18:12 [Qemu-devel] [PATCH] fix qemu_get_cpu(), should return NULL if CPU not found Igor Mammedov
2013-03-12  9:42 ` Andreas Färber

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.