Received: from eggs.gnu.org ([2001:4830:134:3::10]:56961) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmZEi-00043z-VE for qemu-devel@nongnu.org; Thu, 06 Nov 2014 21:25:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XmZEb-0005vF-Ko for qemu-devel@nongnu.org; Thu, 06 Nov 2014 21:25:16 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:21745) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmZEb-0005tu-CE for qemu-devel@nongnu.org; Thu, 06 Nov 2014 21:25:09 -0500 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NEN0048WDDTK980@mailout2.samsung.com> for qemu-devel@nongnu.org; Fri, 07 Nov 2014 11:25:05 +0900 (KST) From: SeokYeon Hwang Date: Fri, 07 Nov 2014 11:24:55 +0900 Message-id: <1415327095-29770-1-git-send-email-syeon.hwang@samsung.com> Subject: [Qemu-devel] [PATCH v2] error: passing a negative value to an os_errno is wrong List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kongjianjun@gmail.com, paolo.bonzini@gmail.com, armbru@redhat.com, mreitz@redhat.com, SeokYeon Hwang 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..4ce22cc 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)); -- 2.1.0