From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:38637) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDfJJ-0004ls-B4 for qemu-devel@nongnu.org; Thu, 07 Mar 2013 13:12:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UDfJB-0003Rd-TR for qemu-devel@nongnu.org; Thu, 07 Mar 2013 13:12:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:24798) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDfJB-0003RP-LS for qemu-devel@nongnu.org; Thu, 07 Mar 2013 13:12:49 -0500 From: Igor Mammedov Date: Thu, 7 Mar 2013 19:12:43 +0100 Message-Id: <1362679963-23201-1-git-send-email-imammedo@redhat.com> Subject: [Qemu-devel] [PATCH] fix qemu_get_cpu(), should return NULL if CPU not found List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: afaerber@suse.de 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 --- 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