From: Amos Kong <kongjianjun@gmail.com>
To: SeokYeon Hwang <syeon.hwang@samsung.com>
Cc: mreitz@redhat.com, paolo.bonzini@gmail.com,
qemu-devel@nongnu.org, armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2] error: passing a negative value to an os_errno is wrong
Date: Fri, 7 Nov 2014 13:11:11 +0800 [thread overview]
Message-ID: <20141107051111.GA7704@air.redhat.com> (raw)
In-Reply-To: <1415327095-29770-1-git-send-email-syeon.hwang@samsung.com>
[-- Attachment #1: Type: text/plain, Size: 1405 bytes --]
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()'.
>
> Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
> ---
> 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);
strerror(0) will return string 'Success', do we need to reserve zero here?
assert(os_errno >= 0);
>
> err = g_malloc0(sizeof(*err));
>
> --
> 2.1.0
>
--
Amos.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2014-11-07 5:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-07 2:24 [Qemu-devel] [PATCH v2] error: passing a negative value to an os_errno is wrong SeokYeon Hwang
2014-11-07 5:11 ` Amos Kong [this message]
2014-11-07 7:41 ` Markus Armbruster
2014-11-10 5:56 ` SeokYeon Hwang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141107051111.GA7704@air.redhat.com \
--to=kongjianjun@gmail.com \
--cc=armbru@redhat.com \
--cc=mreitz@redhat.com \
--cc=paolo.bonzini@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=syeon.hwang@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.