diff mbox series

[BlueZ] mesh: Zero out config node struct before initializing

Message ID 20201202211151.148651-1-inga.stotland@intel.com
State New
Headers show
Series [BlueZ] mesh: Zero out config node struct before initializing | expand

Commit Message

Inga Stotland Dec. 2, 2020, 9:11 p.m. UTC
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.
---
 mesh/node.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Brian Gix Dec. 4, 2020, 6:11 p.m. UTC | #1
Applied
On Wed, 2020-12-02 at 13:11 -0800, Inga Stotland wrote:
> 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.

> ---

>  mesh/node.c | 2 ++

>  1 file changed, 2 insertions(+)

> 

> diff --git a/mesh/node.c b/mesh/node.c

> index 35293e0f0..4bc11309b 100644

> --- a/mesh/node.c

> +++ b/mesh/node.c

> @@ -856,6 +856,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;
diff mbox series

Patch

diff --git a/mesh/node.c b/mesh/node.c
index 35293e0f0..4bc11309b 100644
--- a/mesh/node.c
+++ b/mesh/node.c
@@ -856,6 +856,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;