From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52863) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WuKUn-0003TJ-Jn for qemu-devel@nongnu.org; Tue, 10 Jun 2014 07:45:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WuKUh-0004TH-GE for qemu-devel@nongnu.org; Tue, 10 Jun 2014 07:45:41 -0400 Message-ID: <5396EFD7.1070206@redhat.com> Date: Tue, 10 Jun 2014 13:45:27 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1402381083-17241-1-git-send-email-aik@ozlabs.ru> <1402381083-17241-2-git-send-email-aik@ozlabs.ru> <20140610134340.35a18fff.cornelia.huck@de.ibm.com> In-Reply-To: <20140610134340.35a18fff.cornelia.huck@de.ibm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v5 1/4] cpus: Define callback for QEMU "nmi" command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cornelia Huck , Alexey Kardashevskiy Cc: Peter Maydell , qemu-ppc@nongnu.org, qemu-devel@nongnu.org, Alexander Graf Il 10/06/2014 13:43, Cornelia Huck ha scritto: >> > + CPUState *cs = qemu_get_cpu(monitor_get_cpu_index()); >> > + CPUClass *cc = CPU_GET_CLASS(cs); > Just wondering: Is CPU_GET_CLASS(NULL) really safe? No, it's not... >> > + >> > + if (cs && cc->nmi_monitor_handler) { > Or is cs == NULL simply not possible, and the code should check for > cc != NULL here instead? ... and cc cannot be NULL either here. Paolo >> > + cc->nmi_monitor_handler(cs, errp);