From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53691) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmbpW-0004RW-TL for qemu-devel@nongnu.org; Fri, 07 Nov 2014 00:11:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XmbpQ-0007YC-1H for qemu-devel@nongnu.org; Fri, 07 Nov 2014 00:11:26 -0500 Received: from mail-pd0-x22c.google.com ([2607:f8b0:400e:c02::22c]:54308) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmbpP-0007Xy-Q2 for qemu-devel@nongnu.org; Fri, 07 Nov 2014 00:11:19 -0500 Received: by mail-pd0-f172.google.com with SMTP id r10so2596082pdi.17 for ; Thu, 06 Nov 2014 21:11:18 -0800 (PST) Date: Fri, 7 Nov 2014 13:11:11 +0800 From: Amos Kong Message-ID: <20141107051111.GA7704@air.redhat.com> References: <1415327095-29770-1-git-send-email-syeon.hwang@samsung.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="5mCyUwZo2JvN/JJP" Content-Disposition: inline In-Reply-To: <1415327095-29770-1-git-send-email-syeon.hwang@samsung.com> Subject: Re: [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: SeokYeon Hwang Cc: mreitz@redhat.com, paolo.bonzini@gmail.com, qemu-devel@nongnu.org, armbru@redhat.com --5mCyUwZo2JvN/JJP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Nov 07, 2014 at 11:24:55AM +0900, SeokYeon Hwang wrote: > Added 'assert(os_errno > 0)' in 'error_set_errno()'. > Fixed errno since it passes wrong value to 'error_set_errno()'. >=20 > Signed-off-by: SeokYeon Hwang > --- > hw/pci/pcie.c | 2 +- > util/error.c | 1 + > 2 files changed, 2 insertions(+), 1 deletion(-) >=20 > 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 *h= otplug_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 lock= ed"); > + error_setg_errno(errp, EBUSY, "slot is electromechanically locke= d"); > } > } > =20 > 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, ErrorC= lass err_class, > return; > } > assert(*errp =3D=3D NULL); > + assert(os_errno > 0); strerror(0) will return string 'Success', do we need to reserve zero here? assert(os_errno >=3D 0); > =20 > err =3D g_malloc0(sizeof(*err)); > =20 > --=20 > 2.1.0 >=20 --=20 Amos. --5mCyUwZo2JvN/JJP Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJUXFRvAAoJELxSv6I5vP9jIcwQAI8OPhX2if3Pmiyk/8N9fiL8 ckzqpOslT+0U8Yn9C8fmfzetGZQU9ZZzu4eJFFSN364HGDqRYcx9OpdNquXF1qIf FigdVWD44PSrY1VTP7tUp1XEgE9iEuF0bd/BcVrRpCNL5q6eMwfGRnOv9e/4EQee ycQYl4/b85qpdPXhGRXXFJ+JDedL5GVgkT356SfBbmJKwiFAQuLPRTuAu5ZHF4Kx VQQjqMpdK9X4BrZISjZGGwgbS9nlmR0fzwZAijK0/pTkzH5smxR3qda0KK1MH1+y /Ul4brsifqeEYoMSULwnbrZy+p+4dTnuwJLUC5OGRF0Z4FFkdacGALNiCWJhLqML kHK4Q71t0V4fXgaZHFwCZejt53baeizwrA5JlfcSUTK786TJ7Om5NWs12fyE/1Hv sIJp0M4cuBOkIsKSBXcb3ToOaibfQE8mwhbcC0FAsj710o301Yve5S0pQQpu/f9v LXK90uURmQF+g9xsMZEMssQTwUuDjRPXemUKt3uQxN/yjTS+T8m3tPGl0Bmj/wq5 NTZE4BVUvwlZ+FOqev8OZ2pFWKrcsoVsKERHAPf7Qda/Ri/AyvYNjDYPS7HvTqRB 4HINV01vI+iD3sNoJjx+4R/2QPL/BPVABZJ26s5NxJu4OGv5dEYcUG4Mzhqmi8CL RT4/T8Y0Q0rx3BTaaGqH =kZgs -----END PGP SIGNATURE----- --5mCyUwZo2JvN/JJP--