From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38479) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJ0Db-0001CR-Ki for qemu-devel@nongnu.org; Wed, 04 Feb 2015 08:42:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJ0DT-0000eJ-FB for qemu-devel@nongnu.org; Wed, 04 Feb 2015 08:42:11 -0500 Message-ID: <54D221A8.8030901@suse.de> Date: Wed, 04 Feb 2015 14:42:00 +0100 From: Alexander Graf MIME-Version: 1.0 References: <1420417588-32562-1-git-send-email-gwshan@linux.vnet.ibm.com> <1420417588-32562-3-git-send-email-gwshan@linux.vnet.ibm.com> <20150114014159.GR3654@voom.BigPond> In-Reply-To: <20150114014159.GR3654@voom.BigPond> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v15 2/2] sPAPR: Implement sPAPRPHBClass::eeh_handler List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson , Gavin Shan Cc: aik@ozlabs.ru, alex.williamson@redhat.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org On 14.01.15 02:41, David Gibson wrote: > On Mon, Jan 05, 2015 at 11:26:28AM +1100, Gavin Shan wrote: >> The patch implements sPAPRPHBClass::eeh_handler so that the >> EEH RTAS requests can be routed to VFIO for further handling. >> >> Signed-off-by: Gavin Shan >> --- >> hw/ppc/spapr_pci_vfio.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ >> hw/vfio/common.c | 1 + >> 2 files changed, 57 insertions(+) >> >> diff --git a/hw/ppc/spapr_pci_vfio.c b/hw/ppc/spapr_pci_vfio.c >> index 144912b..73652a9 100644 >> --- a/hw/ppc/spapr_pci_vfio.c >> +++ b/hw/ppc/spapr_pci_vfio.c >> @@ -71,6 +71,61 @@ static void spapr_phb_vfio_finish_realize(sPAPRPHBState *sphb, Error **errp) >> spapr_tce_get_iommu(tcet)); >> } >> >> +static int spapr_phb_vfio_eeh_handler(sPAPRPHBState *sphb, int req, int opt) >> +{ >> + sPAPRPHBVFIOState *svphb = SPAPR_PCI_VFIO_HOST_BRIDGE(sphb); >> + struct vfio_eeh_pe_op op = { .argsz = sizeof(op) }; > > This is a local variable, which means it won't be initialized. You > never memset() it and it's not obvious that all fields get > initialized, which makes it dangerous to pass to an ioctl(). As far as I understand C, in the construct above all unmentioned fields actually do get initialized to 0. Alex