hw/core/generic-loader: Fix crash when running without CPU
When running QEMU with "-M none -device loader,file=kernel.elf", it currently crashes with a segmentation fault, because the "none"-machine does not have any CPU by default and the generic loader code tries to dereference s->cpu. Fix it by adding an appropriate check for a NULL pointer. Reported-by: NLaurent Vivier <laurent@vivier.eu> Signed-off-by: NThomas Huth <thuth@redhat.com> Reviewed-by: NLaurent Vivier <laurent@vivier.eu> Reviewed-by: NAlistair Francis <alistair.francis@xilinx.com> Signed-off-by: NMichael Tokarev <mjt@tls.msk.ru>
Showing
想要评论请 注册 或 登录