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

[Xen-changelog] [xen master] xenstore: send error earlier in do_mkdir



commit 7d87d31d33ff7c746290886978d172dcab74369d
Author:     Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Wed Jul 20 15:13:41 2016 +0100
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Wed Jul 20 16:09:21 2016 +0100

    xenstore: send error earlier in do_mkdir
    
    XenServer's coverity instance complains that a few lines below
    create_node dereferences NULL if name == NULL. It however fails to
    figure out that if node is NULL, errno won't be ENOENT, so do_mkdir
    should have bailed before create_node.
    
    That said, it would be good if we don't need to go through the hops.  We
    can bail earlier if name is NULL.
    
    Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/xenstore/xenstored_core.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index ffc0634..5b2a49b 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -981,6 +981,12 @@ static void do_mkdir(struct connection *conn, struct 
buffered_data *in)
        struct node *node;
        const char *name = onearg(in);
 
+       if (!name) {
+               errno = EINVAL;
+               send_error(conn, errno);
+               return;
+       }
+
        name = canonicalize(conn, name);
        node = get_node(conn, in, name, XS_PERM_WRITE);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
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®.