From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45636) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XnkSk-00049Y-4z for qemu-devel@nongnu.org; Mon, 10 Nov 2014 03:36:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XnkSf-0006Qv-C9 for qemu-devel@nongnu.org; Mon, 10 Nov 2014 03:36:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43550) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XnkSf-0006NT-4v for qemu-devel@nongnu.org; Mon, 10 Nov 2014 03:36:33 -0500 Message-ID: <54607909.9020702@redhat.com> Date: Mon, 10 Nov 2014 09:36:25 +0100 From: Max Reitz MIME-Version: 1.0 References: <1415598889-11244-1-git-send-email-syeon.hwang@samsung.com> In-Reply-To: <1415598889-11244-1-git-send-email-syeon.hwang@samsung.com> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3] error: passing a negative value to an os_errno is wrong List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: SeokYeon Hwang , qemu-devel@nongnu.org Cc: kongjianjun@gmail.com, paolo.bonzini@gmail.com, armbru@redhat.com On 2014-11-10 at 06:54, SeokYeon Hwang wrote: > Added 'assert(os_errno > 0)' in 'error_set_errno()'. > Fixed errno since it passes wrong value to 'error_set_errno()'. > > Signed-off-by: SeokYeon Hwang > --- > hw/pci/pcie.c | 2 +- > util/error.c | 1 + > 2 files changed, 2 insertions(+), 1 deletion(-) > > diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c > index 58455bd..2902f7d 100644 > --- a/hw/pci/pcie.c > +++ b/hw/pci/pcie.c > @@ -229,7 +229,7 @@ static void pcie_cap_slot_hotplug_common(PCIDevice *hotplug_dev, > /* the slot is electromechanically locked. > * This error is propagated up to qdev and then to HMP/QMP. > */ > - error_setg_errno(errp, -EBUSY, "slot is electromechanically locked"); > + error_setg_errno(errp, EBUSY, "slot is electromechanically locked"); > } > } > > diff --git a/util/error.c b/util/error.c > index 2ace0d8..6c9d995 100644 > --- a/util/error.c > +++ b/util/error.c > @@ -62,6 +62,7 @@ void error_set_errno(Error **errp, int os_errno, ErrorClass err_class, > return; > } > assert(*errp == NULL); > + assert(os_errno >= 0); > > err = g_malloc0(sizeof(*err)); > Reviewed-by: Max Reitz