You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by na...@apache.org on 2021/05/27 08:20:46 UTC

[mynewt-nimble] 19/31: Revert "mesh: Check model publish pointer before dereferencing"

This is an automated email from the ASF dual-hosted git repository.

naraj pushed a commit to branch revert-958-mesh_sync_march21
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 7d4b4374ba8054318cbb3b58e76b37c175bb04ac
Author: MichaƂ Narajowski <mi...@codecoup.pl>
AuthorDate: Thu May 27 10:20:19 2021 +0200

    Revert "mesh: Check model publish pointer before dereferencing"
    
    This reverts commit 5e24948f0f409826cedcf8a6a1c0189024ce85cd.
---
 nimble/host/mesh/src/access.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/nimble/host/mesh/src/access.c b/nimble/host/mesh/src/access.c
index d23a656..da07718 100644
--- a/nimble/host/mesh/src/access.c
+++ b/nimble/host/mesh/src/access.c
@@ -682,15 +682,8 @@ int bt_mesh_model_send(struct bt_mesh_model *model,
 
 int bt_mesh_model_publish(struct bt_mesh_model *model)
 {
-	int err;
 	struct os_mbuf *sdu = NET_BUF_SIMPLE(BT_MESH_TX_SDU_MAX);
 	struct bt_mesh_model_pub *pub = model->pub;
-
-	if (!pub) {
-		err = -ENOTSUP;
-		goto done;
-	}
-
 	struct bt_mesh_msg_ctx ctx = {
 		.addr = pub->addr,
 		.send_ttl = pub->ttl,
@@ -701,9 +694,15 @@ int bt_mesh_model_publish(struct bt_mesh_model *model)
 		.ctx = &ctx,
 		.src = bt_mesh_model_elem(model)->addr,
 	};
+	int err;
 
 	BT_DBG("");
 
+	if (!pub) {
+		err = -ENOTSUP;
+		goto done;
+	}
+
 	if (pub->addr == BT_MESH_ADDR_UNASSIGNED) {
 		err = -EADDRNOTAVAIL;
 		goto done;