mesh: Zero out config node struct before initializing
authorInga Stotland <inga.stotland@intel.com>
Wed, 2 Dec 2020 21:11:51 +0000 (13:11 -0800)
committerAbhay Agarwal <ay.agarwal@samsung.com>
Mon, 28 Dec 2020 06:20:04 +0000 (11:50 +0530)
This memsets all the fields of mesh_db_node to zero prior to intializing
some fields in mesh_config_node struct and creating a brand new node
configuration. Just a precaution against having uninitialized items.

Change-Id: I92528e58d399db611e84fdacf6399281e4ffc54d
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
mesh/node.c

index dc85123..0ec9325 100644 (file)
@@ -872,6 +872,8 @@ static void convert_node_to_storage(struct mesh_node *node,
 {
        const struct l_queue_entry *entry;
 
+       memset(db_node, 0, sizeof(struct mesh_config_node));
+
        db_node->cid = node->comp.cid;
        db_node->pid = node->comp.pid;
        db_node->vid = node->comp.vid;