From 7dc8f656082f7077160cc4a1864f89912b798f4e Mon Sep 17 00:00:00 2001 From: Tom Tucker Date: Sun, 13 Dec 2020 13:30:01 -0700 Subject: [PATCH] Fix rejected event initialization The rejected event initialization referred to itself. The updated compiler apparently does not guarantee ordering for static initializers. --- lib/src/zap/ugni/zap_ugni.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/src/zap/ugni/zap_ugni.c b/lib/src/zap/ugni/zap_ugni.c index 3fe6f930b..bba2b08d3 100644 --- a/lib/src/zap/ugni/zap_ugni.c +++ b/lib/src/zap/ugni/zap_ugni.c @@ -888,13 +888,14 @@ static void process_uep_msg_rejected(struct z_ugni_ep *uep) { struct zap_ugni_msg_regular *msg; int rc; + size_t data_len; msg = (void*)uep->rbuff->data; - + data_len = ntohl(msg->data_len); struct zap_event ev = { .type = ZAP_EVENT_REJECTED, - .data_len = ntohl(msg->data_len), - .data = (ev.data_len ? (void*)msg->data : NULL) + .data_len = data_len, + .data = (data_len ? (void *)msg->data : NULL) }; rc = zap_ep_change_state(&uep->ep, ZAP_EP_CONNECTING, ZAP_EP_ERROR); if (rc != ZAP_ERR_OK) {