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

[Xen-changelog] [xen master] libxc: check for null size file mapping



commit d9d8b2678fed1de8242afe90c923b2d5d67eb516
Author:     Paul Semel <semelpaul@xxxxxxxxx>
AuthorDate: Mon Feb 12 13:09:15 2018 +0100
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Tue Feb 13 11:45:56 2018 +0000

    libxc: check for null size file mapping
    
    Changed the error message when trying to map a null size file.
    When doing `xl create` command, we get an Invalid Kernel error
    when the file size is greater than zero. For zero length files, we are
    falling in the mmap error, and we get an `Invalid parameter` error,
    which is not explicit. With this change, we get a `zero length file`
    error.
    
    Signed-off-by: Paul Semel <semelpaul@xxxxxxxxx>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 tools/libxc/xc_dom_core.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/libxc/xc_dom_core.c b/tools/libxc/xc_dom_core.c
index 96e71dd..9bd04cb 100644
--- a/tools/libxc/xc_dom_core.c
+++ b/tools/libxc/xc_dom_core.c
@@ -225,6 +225,12 @@ void *xc_dom_malloc_filemap(struct xc_dom_image *dom,
                      "tried to map file which is too large");
         goto err;
     }
+    else if ( !*size )
+    {
+        xc_dom_panic(dom->xch, XC_INTERNAL_ERROR,
+                     "'%s': zero length file", filename);
+        goto err;
+    }
 
     block = malloc(sizeof(*block));
     if ( block == NULL ) {
--
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®.