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

[xen staging] xenstore: add missing NULL check

commit 0bdaa8b035ec9fbdfd4e4f25f0577016c94b7a50
Author:     Norbert Manthey <nmanthey@xxxxxxxxx>
AuthorDate: Fri Feb 26 15:41:35 2021 +0100
Commit:     Julien Grall <jgrall@xxxxxxxxxx>
CommitDate: Wed Mar 3 18:11:11 2021 +0000

    xenstore: add missing NULL check
    In case of allocation error, we should not dereference the obtained
    NULL pointer. Hence, fail early.
    This bug was discovered and resolved using Coverity Static Analysis
    Security Testing (SAST) by Synopsys, Inc.
    Signed-off-by: Norbert Manthey <nmanthey@xxxxxxxxx>
    Reviewed-by: Thomas Friebel <friebelt@xxxxxxxxx>
    Reviewed-by: Julien Grall <jgrall@xxxxxxxxxxxx>
    Reviewed-by: Juergen Gross <jgross@xxxxxxxx>
    Release-Acked-by: Ian Jackson <iwj@xxxxxxxxxxxxxx>
 tools/xenstore/xenstored_core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 0fea598352..3803aef081 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -1818,6 +1818,10 @@ static int check_store_(const char *name, struct 
hashtable *reachable)
                struct hashtable * children =
                        create_hashtable(16, hash_from_key_fn, keys_equal_fn);
+               if (!children) {
+                       log("check_store create table: ENOMEM");
+                       return ENOMEM;
+               }
                if (!remember_string(reachable, name)) {
                        hashtable_destroy(children, 0);
generated by git-patchbot for /home/xen/git/xen.git#staging



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