[PATCH 2/2] mesh: node: Correct minor errors

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

 



Correct length computation in node_parse_composition()
Correct return value in node_set_model()
  An existing node is not an error
---
 mesh/node.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mesh/node.c b/mesh/node.c
index fc8898c49..9ff741962 100644
--- a/mesh/node.c
+++ b/mesh/node.c
@@ -417,7 +417,7 @@ bool node_parse_composition(struct mesh_node *node, uint8_t *data, uint16_t len)
 
 		m = *data++;
 		v = *data++;
-		len -= 4;
+		len -= 2;
 
 		while (len >= 2 && m--) {
 			mod_id = get_le16(data);
@@ -691,7 +691,7 @@ bool node_set_model(struct mesh_node *node, uint8_t ele_idx, uint32_t id)
 	l = g_list_find_custom(ele->models, GUINT_TO_POINTER(id),
 				match_model_id);
 	if (l)
-		return false;
+		return true;
 
 	model = g_malloc0(sizeof(struct mesh_model));
 	if (!model)
-- 
2.14.1

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux