diff mbox series

[4/4] tools/libs/light: don't set errno to a negative value

Message ID 20220420073119.16974-5-jgross@suse.com (mailing list archive)
State New, archived
Headers show
Series tools/libs: don't set errno to negative values | expand

Commit Message

Jürgen Groß April 20, 2022, 7:31 a.m. UTC
Setting errno to a negative value makes no sense.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 tools/libs/light/libxl_linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andrew Cooper April 22, 2022, 2:52 p.m. UTC | #1
On 20/04/2022 08:31, Juergen Gross wrote:
> Setting errno to a negative value makes no sense.

Fixes: e78e8b9bb649b

> Signed-off-by: Juergen Gross <jgross@suse.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Jürgen Groß April 22, 2022, 2:55 p.m. UTC | #2
On 22.04.22 16:52, Andrew Cooper wrote:
> On 20/04/2022 08:31, Juergen Gross wrote:
>> Setting errno to a negative value makes no sense.
> 
> Fixes: e78e8b9bb649b
> 
>> Signed-off-by: Juergen Gross <jgross@suse.com>
> 
> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>

Do you want me to send the patches with the Fixes tags added?

TBH I didn't bother to do the research for those, as the wrong values
don't seem to cause any harm today. I just stumbled over the issues
and thought it would be a good idea to fix those.


Juergen
Andrew Cooper April 22, 2022, 2:59 p.m. UTC | #3
On 22/04/2022 15:55, Juergen Gross wrote:
> On 22.04.22 16:52, Andrew Cooper wrote:
>> On 20/04/2022 08:31, Juergen Gross wrote:
>>> Setting errno to a negative value makes no sense.
>>
>> Fixes: e78e8b9bb649b
>>
>>> Signed-off-by: Juergen Gross <jgross@suse.com>
>>
>> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
>
> Do you want me to send the patches with the Fixes tags added?
>
> TBH I didn't bother to do the research for those, as the wrong values
> don't seem to cause any harm today. I just stumbled over the issues
> and thought it would be a good idea to fix those.

Given that there's nothing else to adjust, I was thinking of just fixing
them on commit.

But we should backport these to all appropriate releases (cc Jan).

~Andrew
diff mbox series

Patch

diff --git a/tools/libs/light/libxl_linux.c b/tools/libs/light/libxl_linux.c
index 8d62dfd255..27f2bce718 100644
--- a/tools/libs/light/libxl_linux.c
+++ b/tools/libs/light/libxl_linux.c
@@ -288,7 +288,7 @@  int libxl__pci_topology_init(libxl__gc *gc,
         if (i == num_devs) {
             LOG(ERROR, "Too many devices");
             err = ERROR_FAIL;
-            errno = -ENOSPC;
+            errno = ENOSPC;
             goto out;
         }