libxl: init_acpi_config should return rc in exit path
PATCH 1/1 libxl: init_acpi_config should return rc in exit path
... otherwise it returns 0 even if the function fails.
---
Cc: Ian Jackson <[email protected]>
This should be backported to 4.8.
--- tools/libxl/libxl_x86_acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxl/libxl_x86_acpi.c +1 -1
@@ -154,7 +154,7 @@ static int init_acpi_config(libxl__gc *gc, config->acpi_revision =5 ; out: -return 0 ; +return rc; } int libxl__dom_load_acpi(libxl__gc *gc,
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 1 line · Wei Liu
... otherwise it returns 0 even if the function fails.
Coverity-ID: 1397121
Quoted 1 line
Signed-off-by Wei Liu <[email protected]>
Quoted 13 lines
---
Cc: Ian Jackson <[email protected]>This should be backported to 4.8.
--- tools/libxl/libxl_x86_acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/libxl/libxl_x86_acpi.c +0
-0
tools/libxl/libxl_x86_acpi.c static int init_acpi_config(libxl__gc *gc, · line 160
Quoted 8 lines
tools/libxl/libxl_x86_acpi.c +1
-1@@ -154,7 +154,7 @@ static int init_acpi_config(libxl__gc *gc, config->acpi_revision =5 ; out: -return 0 ; +return rc; } int libxl__dom_load_acpi(libxl__gc *gc,
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 5 lines · Andrew Cooper
Quoted 1 line · Wei Liu
... otherwise it returns 0 even if the function fails.
Coverity-ID: 1397121
Does it work this way? Coverity does lead to the discovery of this bug, but this CID doesn't reveal the bug directly.
Quoted 19 lines
Quoted 1 line
Signed-off-by Wei Liu <[email protected]>Reviewed-by Andrew Cooper <[email protected]>Quoted 15 lines
---
Cc: Ian Jackson <[email protected]>This should be backported to 4.8.
--- tools/libxl/libxl_x86_acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/libxl/libxl_x86_acpi.c +0
-0@@ -154,7 +154,7 @@ static int init_acpi_config(libxl__gc *gc, config->acpi_revision =5 ;
Quoted 7 lines
tools/libxl/libxl_x86_acpi.c static int init_acpi_config(libxl__gc *gc, · line 160
Quoted 6 lines
tools/libxl/libxl_x86_acpi.c +1
-1out: -return 0 ; +return rc; } int libxl__dom_load_acpi(libxl__gc *gc,
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 24 lines · Andrew Cooper
Quoted 1 line · Wei Liu
... otherwise it returns 0 even if the function fails.
Coverity-ID: 1397121
Quoted 1 line
Signed-off-by Wei Liu <[email protected]>Reviewed-by Andrew Cooper <[email protected]>Quoted 15 lines
---
Cc: Ian Jackson <[email protected]>This should be backported to 4.8.
--- tools/libxl/libxl_x86_acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/libxl/libxl_x86_acpi.c +0
-0@@ -154,7 +154,7 @@ static int init_acpi_config(libxl__gc *gc, config->acpi_revision =5 ;
Quoted 3 lines
tools/libxl/libxl_x86_acpi.c static int init_acpi_config(libxl__gc *gc, · line 157
Quoted 3 lines
tools/libxl/libxl_x86_acpi.c +1
-1out: -return 0 ; +return rc;
This breaks init_acpi_config(): xc_domain_getinfo() at the top of returns a positive number (number of domains).
-boris
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 25 lines · Boris Ostrovsky
Quoted 24 lines · Andrew Cooper
Quoted 1 line · Wei Liu
... otherwise it returns 0 even if the function fails.
Coverity-ID: 1397121
Quoted 1 line
Signed-off-by Wei Liu <[email protected]>Reviewed-by Andrew Cooper <[email protected]>Quoted 15 lines
---
Cc: Ian Jackson <[email protected]>This should be backported to 4.8.
--- tools/libxl/libxl_x86_acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/libxl/libxl_x86_acpi.c +0
-0@@ -154,7 +154,7 @@ static int init_acpi_config(libxl__gc *gc, config->acpi_revision =5 ;
Quoted 7 lines
Quoted 3 lines
tools/libxl/libxl_x86_acpi.c static int init_acpi_config(libxl__gc *gc, · line 157
Quoted 3 lines
tools/libxl/libxl_x86_acpi.c +1
-1out: -return 0 ; +return rc;This breaks
init_acpi_config():xc_domain_getinfo()at the top of returns a positive number (number of domains).
I see, I think we also need to set rc=0 in the success path.
Wei.
Quoted 3 lines
-boris
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 2 lines · Wei Liu
I see, I think we also need to set rc=0 in the success path.
Or 'return rc < 0 ? rc : 0;'
-boris
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 6 lines · Boris Ostrovsky
Quoted 2 lines · Wei Liu
I see, I think we also need to set rc=0 in the success path.
Or 'return rc < 0 ? rc : 0;'
I don't think so, because there could be functions that only return >0 values to indicate error.
Wei.
Quoted 1 line
-boris
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Wei Liu writes ("Re: [Xen-devel] [PATCH] libxl: init_acpi_config should return rc in exit path"):
Quoted 2 lines
I don't think so, because there could be functions that only return >0 values to indicate error.
The problem here is the violation of the CODING_STYLE which forbids the use of `rc' to contain anything other than a libxl error value.
`r' should be used for the values from libxc. And each failure path should set rc.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Wei Liu writes ("[PATCH] libxl: init_acpi_config should return rc in exit path"):
Quoted 1 line
... otherwise it returns 0 even if the function fails.
FTR, I'm happy for obvious patches from you, like this one, to go in without waiting for my ack!
Thanks,
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 5 lines · Ian Jackson
Wei Liu writes ("[PATCH] libxl:
init_acpi_configshould return rc in exit path"):Quoted 1 line
... otherwise it returns 0 even if the function fails.
Acked-by Ian Jackson <[email protected]>
Thanks.
Quoted 3 lines
FTR, I'm happy for obvious patches from you, like this one, to go in without waiting for my ack!
Noted.
Quoted 2 lines
Thanks,
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 7 lines · Wei Liu
... otherwise it returns 0 even if the function fails.
Signed-off-by Wei Liu <[email protected]>---
Cc: Ian Jackson <[email protected]>This should be backported to 4.8.
And please don't just apply this one patch because it is buggy.
You would also need "libxl: set rc to 0 in init_acpi_config in success path".
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Wei Liu writes ("Re: [PATCH] libxl: init_acpi_config should return rc in exit path"):
Quoted 5 lines
And please don't just apply this one patch because it is buggy.
You would also need "libxl: set rc to 0 in
init_acpi_configin success path".
Noted, thanks.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel