From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58700) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgIZs-0002nr-1O for qemu-devel@nongnu.org; Thu, 09 Apr 2015 15:57:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YgIZn-0001Bf-1c for qemu-devel@nongnu.org; Thu, 09 Apr 2015 15:57:27 -0400 Received: from mail-wg0-x233.google.com ([2a00:1450:400c:c00::233]:36079) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgIZm-0001BW-R5 for qemu-devel@nongnu.org; Thu, 09 Apr 2015 15:57:22 -0400 Received: by wgsk9 with SMTP id k9so108733295wgs.3 for ; Thu, 09 Apr 2015 12:57:22 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <5526D99D.7010103@redhat.com> Date: Thu, 09 Apr 2015 21:57:17 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1428586365-17909-1-git-send-email-thuth@redhat.com> <5526C58F.2050805@redhat.com> In-Reply-To: <5526C58F.2050805@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] Fix crash with illegal "-net nic, model=xxx" option List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , Thomas Huth , qemu-devel@nongnu.org Cc: jasowang@redhat.com, stefanha@redhat.com, mst@redhat.com On 09/04/2015 20:31, Eric Blake wrote: >> diff --git a/hw/pci/pci.c b/hw/pci/pci.c >> index 6941a82..b3d5100 100644 >> --- a/hw/pci/pci.c >> +++ b/hw/pci/pci.c >> @@ -1660,7 +1660,9 @@ PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus, >> >> res = pci_nic_init(nd, rootbus, default_model, default_devaddr, &err); >> if (!res) { >> - error_report_err(err); >> + if (err) { >> + error_report_err(err); >> + } >> exit(1); > > Doesn't this mean the program can exit without an error message, if > pci_nic_init returns failure but failed to set err? Shouldn't you at > least print something in that case as an else branch? git grep 'Unsupported NIC model' shows that the error is printed with error_report; same for other errors produced by pci_nic_init. This is not beautiful compared to correct propagation of Error*, but it's okay because -net is only used at startup. It's good enough for rc3. Paolo