* [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
* Re: [Qemu-devel] [PATCH] fix qemu_get_cpu(), should return NULL if CPU not found
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
0 siblings, 0 replies; 2+ messages in thread
From: Andreas Färber @ 2013-03-12 9:42 UTC (permalink / raw)
To: Igor Mammedov; +Cc: qemu-ppc, qemu-devel, Alexander Graf
Am 07.03.2013 19:12, schrieb Igor Mammedov:
> 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>
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
> ---
> 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)
>
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).