[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] libxc: Cleanup xc_dom_parse_elf_kernel()'s return value



commit fc9061883a9a978c44d65aa4849ce608880ed8dd
Author:     Simon Gaiser <simon@xxxxxxxxxxxxxxxxxxxxxx>
AuthorDate: Thu Feb 8 22:49:08 2018 +0100
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Tue Feb 13 11:48:28 2018 +0000

    libxc: Cleanup xc_dom_parse_elf_kernel()'s return value
    
    xc_dom_loader.parser() should return elf_negerrnoval.
    
    Signed-off-by: Simon Gaiser <simon@xxxxxxxxxxxxxxxxxxxxxx>
    Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 tools/libxc/xc_dom_elfloader.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/tools/libxc/xc_dom_elfloader.c b/tools/libxc/xc_dom_elfloader.c
index 568d7f3..c936f92 100644
--- a/tools/libxc/xc_dom_elfloader.c
+++ b/tools/libxc/xc_dom_elfloader.c
@@ -140,14 +140,10 @@ static elf_negerrnoval xc_dom_probe_elf_kernel(struct 
xc_dom_image *dom)
     return 0;
 }
 
-static elf_errorstatus xc_dom_parse_elf_kernel(struct xc_dom_image *dom)
-    /*
-     * This function sometimes returns -1 for error and sometimes
-     * an errno value.  ?!?!
-     */
+static elf_negerrnoval xc_dom_parse_elf_kernel(struct xc_dom_image *dom)
 {
     struct elf_binary *elf;
-    elf_errorstatus rc;
+    elf_negerrnoval rc;
 
     rc = check_elf_kernel(dom, 1);
     if ( rc != 0 )
@@ -155,9 +151,9 @@ static elf_errorstatus xc_dom_parse_elf_kernel(struct 
xc_dom_image *dom)
 
     elf = xc_dom_malloc(dom, sizeof(*elf));
     if ( elf == NULL )
-        return -1;
+        return -ENOMEM;
     dom->private_loader = elf;
-    rc = elf_init(elf, dom->kernel_blob, dom->kernel_size);
+    rc = elf_init(elf, dom->kernel_blob, dom->kernel_size) != 0 ? -EINVAL : 0;
     xc_elf_set_logfile(dom->xch, elf, 1);
     if ( rc != 0 )
     {
@@ -177,8 +173,9 @@ static elf_errorstatus xc_dom_parse_elf_kernel(struct 
xc_dom_image *dom)
 
     /* parse binary and get xen meta info */
     elf_parse_binary(elf);
-    if ( (rc = elf_xen_parse(elf, &dom->parms)) != 0 )
+    if ( elf_xen_parse(elf, &dom->parms) != 0 )
     {
+        rc = -EINVAL;
         goto out;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.