Skip to contentSkip to conversation

error: passing a negative value to an os_errno is wrong

PATCH Superseded SeokYeon Hwang 5 participants 9 messages Nov 10, 2014 – Nov 12, 2014

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 error: passing a negative value to an os_errno is wrong

Added 'assert(os_errno > 0)' in 'error_set_errno()'. Fixed errno since it passes wrong value to 'error_set_errno()'.

---
 hw/pci/pcie.c | 2 +-
 util/error.c  | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
hw/pci/pcie.c +1 -1
index 58455bd..2902f7d 100644
@@ -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");
     }
 }
 
util/error.c +1 -0
index 2ace0d8..6c9d995 100644
@@ -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));
 
Signature · 1 line
2.1.0
Reviewed-by on v3 1/1
#1 lore raw
Quoted 4 lines · SeokYeon Hwang

Added 'assert(os_errno > 0)' in 'error_set_errno()'. Fixed errno since it passes wrong value to 'error_set_errno()'.

Quoted 33 lines
---
 hw/pci/pcie.c | 2 +-
 util/error.c  | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
hw/pci/pcie.c +1 -1
index 58455bd..2902f7d 100644
@@ -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");
     }
 }
 
util/error.c +1 -0
index 2ace0d8..6c9d995 100644
@@ -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));
 
Signature · 1 line
2.1.0
Signature · 1 line
			Amos.
Reviewed-by on v3 1/1
#2 lore raw
In reply to SeokYeon Hwang
Quoted 27 lines · SeokYeon Hwang

Added 'assert(os_errno > 0)' in 'error_set_errno()'. Fixed errno since it passes wrong value to 'error_set_errno()'.

---
  hw/pci/pcie.c | 2 +-
  util/error.c  | 1 +
  2 files changed, 2 insertions(+), 1 deletion(-)
hw/pci/pcie.c +1 -1
index 58455bd..2902f7d 100644
@@ -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");
      }
  }
 
util/error.c +0 -0
index 2ace0d8..6c9d995 100644

util/error.c void error_set_errno(Error **errp, int os_errno, ErrorClass err_class, · line 68

Quoted 7 lines
util/error.c +1 -0
@@ -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 on v3 1/1
#3 lore raw
In reply to SeokYeon Hwang
Quoted 27 lines · SeokYeon Hwang

Added 'assert(os_errno > 0)' in 'error_set_errno()'. Fixed errno since it passes wrong value to 'error_set_errno()'.

---
 hw/pci/pcie.c | 2 +-
 util/error.c  | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
hw/pci/pcie.c +1 -1
index 58455bd..2902f7d 100644
@@ -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");
     }
 }
 
util/error.c +0 -0
index 2ace0d8..6c9d995 100644

util/error.c void error_set_errno(Error **errp, int os_errno, ErrorClass err_class, · line 67

Quoted 6 lines
util/error.c +1 -0
@@ -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));

The first hunk could still go into 2.2 as a bug fix. The rest can't. You could post just the first hunk as "[PATCH for-2.2] pci: Don't pass negative errno to error_set_errno()", with my R-by.

#4 lore raw
Quoted 46 lines

-----Original Message-----
From: Markus Armbruster [mailto:[email protected]]
Sent: Monday, November 10, 2014 6:33 PM
To: SeokYeon Hwang
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [Qemu-devel] [PATCH v3] error: passing a negative value to an os_errno is wrong

hw/pci/pcie.c static void pcie_cap_slot_hotplug_common(PCIDevice

Quoted 14 lines · SeokYeon Hwang

Added 'assert(os_errno > 0)' in 'error_set_errno()'. Fixed errno since it passes wrong value to 'error_set_errno()'.

---
 hw/pci/pcie.c | 2 +-
 util/error.c  | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
hw/pci/pcie.c index 58455bd..2902f7d renamed from hw/pci/pcie.c +0 -0

100644

hw/pci/pcie.c +0 -0
@@ -229,7 +229,7 @@ static void pcie_cap_slot_hotplug_common(PCIDevice

*hotplug_dev,

hw/pci/pcie.c static void pcie_cap_slot_hotplug_common(PCIDevice *hotplug_dev,

Quoted 4 lines
hw/pci/pcie.c +0 -1
         /* 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");

util/error.c void error_set_errno(Error **errp, int os_errno,

Quoted 9 lines
hw/pci/pcie.c +2 -0
+        error_setg_errno(errp, EBUSY, "slot is electromechanically
+ locked");
     }
 }
util/error.c +0 -0
@@ -62,6 +62,7 @@ void error_set_errno(Error **errp, int os_errno,

ErrorClass err_class,

Quoted 5 lines
util/error.c +1 -0
         return;
     }
     assert(*errp == NULL);
+    assert(os_errno >= 0);
 
Quoted 7 lines

util/error.c void error_set_errno(Error **errp, int os_errno, ErrorClass err_class, · line 67

Quoted 1 line
util/error.c +0 -0
     err = g_malloc0(sizeof(*err));

The first hunk could still go into 2.2 as a bug fix. The rest can't. You could post just the first hunk as "[PATCH for-2.2] pci: Don't pass negative errno to error_set_errno()", with my R-by.

Did you mean separate this patch into two patches ?? One is "PATCH v4" and the other is "PATCH for-2.2". Am I right??

And I have a question. (I don't know review / merge process well.) What happens to the "reviewed" but "not bug-fix" patch during "feature freeze" time ??

Thanks.

#5 lore raw
Quoted 48 lines · SeokYeon Hwang
Quoted 48 lines

-----Original Message-----
From: Markus Armbruster [mailto:[email protected]]
Sent: Monday, November 10, 2014 6:33 PM
To: SeokYeon Hwang
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [Qemu-devel] [PATCH v3] error: passing a negative value to an os_errno is wrong

hw/pci/pcie.c static void pcie_cap_slot_hotplug_common(PCIDevice

Quoted 14 lines · SeokYeon Hwang

Added 'assert(os_errno > 0)' in 'error_set_errno()'. Fixed errno since it passes wrong value to 'error_set_errno()'.

---
 hw/pci/pcie.c | 2 +-
 util/error.c  | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
hw/pci/pcie.c index 58455bd..2902f7d renamed from hw/pci/pcie.c +0 -0

100644

hw/pci/pcie.c +0 -0
@@ -229,7 +229,7 @@ static void pcie_cap_slot_hotplug_common(PCIDevice

*hotplug_dev,

hw/pci/pcie.c static void pcie_cap_slot_hotplug_common(PCIDevice *hotplug_dev,

Quoted 4 lines
hw/pci/pcie.c +0 -1
         /* 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");

util/error.c void error_set_errno(Error **errp, int os_errno,

Quoted 9 lines
hw/pci/pcie.c +2 -0
+        error_setg_errno(errp, EBUSY, "slot is electromechanically
+ locked");
     }
 }
util/error.c +0 -0
@@ -62,6 +62,7 @@ void error_set_errno(Error **errp, int os_errno,

ErrorClass err_class,

Quoted 6 lines
util/error.c +1 -0
         return;
     }
     assert(*errp == NULL);
+    assert(os_errno >= 0);
 
     err = g_malloc0(sizeof(*err));
Quoted 8 lines
Quoted 5 lines

The first hunk could still go into 2.2 as a bug fix. The rest can't. You could post just the first hunk as "[PATCH for-2.2] pci: Don't pass negative errno to error_set_errno()", with my R-by.

Did you mean separate this patch into two patches ?? One is "PATCH v4" and the other is "PATCH for-2.2". Am I right??

Yes.

Quoted 3 lines

And I have a question. (I don't know review / merge process well.) What happens to the "reviewed" but "not bug-fix" patch during "feature freeze" time ??

They get applied when the next development cycle opens. If they don't, you have to remind the maintainer(s).

#6 lore raw
Quoted 70 lines

-----Original Message-----
From: Markus Armbruster [mailto:[email protected]]
Sent: Monday, November 10, 2014 10:21 PM
To: SeokYeon Hwang
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [Qemu-devel] [PATCH v3] error: passing a negative value to an os_errno is wrong

Quoted 50 lines · SeokYeon Hwang
Quoted 50 lines

-----Original Message-----
From: Markus Armbruster [mailto:[email protected]]
Sent: Monday, November 10, 2014 6:33 PM
To: SeokYeon Hwang
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [Qemu-devel] [PATCH v3] error: passing a negative value to an os_errno is wrong

Quoted 14 lines · SeokYeon Hwang

Added 'assert(os_errno > 0)' in 'error_set_errno()'. Fixed errno since it passes wrong value to 'error_set_errno()'.

---
 hw/pci/pcie.c | 2 +-
 util/error.c  | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
hw/pci/pcie.c index 58455bd..2902f7d renamed from hw/pci/pcie.c +0 -0

100644

hw/pci/pcie.c +0 -0
@@ -229,7 +229,7 @@ static void
Quoted 1 line

pcie_cap_slot_hotplug_common(PCIDevice

*hotplug_dev,

Quoted 4 lines
         /* 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");

util/error.c void error_set_errno(Error **errp, int os_errno,

Quoted 10 lines
hw/pci/pcie.c +2 -0
+        error_setg_errno(errp, EBUSY, "slot is electromechanically
+ locked");
     }
 }
util/error.c index 2ace0d8..6c9d995 renamed from util/error.c +0 -0

100644

util/error.c +0 -0
@@ -62,6 +62,7 @@ void error_set_errno(Error **errp, int os_errno,

ErrorClass err_class,

Quoted 6 lines
util/error.c +1 -0
         return;
     }
     assert(*errp == NULL);
+    assert(os_errno >= 0);
 
     err = g_malloc0(sizeof(*err));
Quoted 8 lines
Quoted 5 lines

The first hunk could still go into 2.2 as a bug fix. The rest can't. You could post just the first hunk as "[PATCH for-2.2] pci: Don't pass negative errno to error_set_errno()", with my R-by.

Did you mean separate this patch into two patches ?? One is "PATCH v4" and the other is "PATCH for-2.2". Am I right??

Quoted 8 lines

Yes.

Quoted 3 lines

And I have a question. (I don't know review / merge process well.) What happens to the "reviewed" but "not bug-fix" patch during "feature freeze" time ??

They get applied when the next development cycle opens. If they don't, you have to remind the maintainer(s).

I just posted separated two patches.
Thank you for your advice.

#7 lore raw
In reply to SeokYeon Hwang
Quoted 1 line · SeokYeon Hwang

Added 'assert(os_errno > 0)' in 'error_set_errno()'.

Commit message...

util/error.c void error_set_errno(Error **errp, int os_errno, ErrorClass err_class, · line 65

Quoted 12 lines

Fixed errno since it passes wrong value to 'error_set_errno()'.

---
 hw/pci/pcie.c | 2 +-

+++ b/util/error.c

util/error.c +1 -0
@@ -62,6 +62,7 @@ void error_set_errno(Error **errp, int os_errno, ErrorClass err_class,
         return;
     }
     assert(*errp == NULL);
+    assert(os_errno >= 0);

...does not match code. (Code is correct).

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#8 lore raw
Quoted 28 lines

-----Original Message-----
From: Eric Blake [mailto:[email protected]]
Sent: Tuesday, November 11, 2014 1:14 AM
To: SeokYeon Hwang; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3] error: passing a negative value to an os_errno is wrong

Quoted 1 line · SeokYeon Hwang

Added 'assert(os_errno > 0)' in 'error_set_errno()'.

Commit message...

Review void error_set_errno(Error **errp, int os_errno,

Quoted 8 lines

Fixed errno since it passes wrong value to 'error_set_errno()'.

---
 hw/pci/pcie.c | 2 +-

+++ b/util/error.c

(quoted diff) +0 -0
@@ -62,6 +62,7 @@ void error_set_errno(Error **errp, int os_errno,

ErrorClass err_class,

util/error.c void error_set_errno(Error **errp, int os_errno, ErrorClass err_class, · line 65

Quoted 4 lines
util/error.c +1 -0
         return;
     }
     assert(*errp == NULL);
+    assert(os_errno >= 0);
Quoted 5 lines

...does not match code. (Code is correct).

--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org

You're right. Thank you.