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

Juergen Gross posted 4 patches 3 years, 9 months ago
[PATCH 4/4] tools/libs/light: don't set errno to a negative value
Posted by Juergen Gross 3 years, 9 months ago
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(-)

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;
         }
 
-- 
2.34.1
Re: [PATCH 4/4] tools/libs/light: don't set errno to a negative value
Posted by Andrew Cooper 3 years, 9 months ago
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>
Re: [PATCH 4/4] tools/libs/light: don't set errno to a negative value
Posted by Juergen Gross 3 years, 9 months ago
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
Re: [PATCH 4/4] tools/libs/light: don't set errno to a negative value
Posted by Andrew Cooper 3 years, 9 months ago
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