qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH for-next 41/74] target-lm32: Let cpu_lm32_init()


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH for-next 41/74] target-lm32: Let cpu_lm32_init() return LM32CPU
Date: Wed, 9 May 2012 21:21:22 +0100

On 9 May 2012 19:36, Andreas Färber <address@hidden> wrote:
> Thanks. Needs a respin though: Peter has noticed that cpu_init() does a
> NULL pointer deference when cpu_xxx_init() returns NULL. I'm rewriting
> as static inline function.

Well, strictly cpu_init() doesn't dereference NULL, because of
the address-of operator: instead it just effectively returns
offsetof(LM32CPU, env). This (being non-zero) doesn't trigger
the caller's "did that fail?" check, and we get a segfault
when the caller later tries to use it as a real pointer.

-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]