pespin submitted this change.

View Change


Approvals: pespin: Looks good to me, approved fixeria: Looks good to me, but someone else must approve Jenkins Builder: Verified
abis_nm: fix -Wunused-but-set-variable (bug)

clang warns us about 'len' being set, but not used: And this is

abis_nm.c:2172:10: warning: variable 'len' set but not used [-Wunused-but-set-variable]
uint8_t len = attr_len;
^

This is actually a bug, because in the case of NACK we append 2 more
bytes {NM_ATT_NACK_CAUSES, NM_NACK_OBJCLASS_NOTSUPP}, and we need to
pass the final length to fill_om_fom_hdr(), including those optional
two bytes. Passing 'attr_len' (length of 'attr') is wrong.

Change-Id: I3ca8e761fdf99dd498a979ccc9d53c6c3e03e2cc
---
M src/osmo-bsc/abis_nm.c
1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/osmo-bsc/abis_nm.c b/src/osmo-bsc/abis_nm.c
index 7a9789b..afb7abc 100644
--- a/src/osmo-bsc/abis_nm.c
+++ b/src/osmo-bsc/abis_nm.c
@@ -2183,7 +2183,7 @@
}

oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
- fill_om_fom_hdr(oh, attr_len, msgtype, obj_class, i1, i2, i3);
+ fill_om_fom_hdr(oh, len, msgtype, obj_class, i1, i2, i3);

if (attr != NULL && attr_len > 0)
memcpy(msgb_put(msg, attr_len), attr, attr_len);

To view, visit change 35791. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I3ca8e761fdf99dd498a979ccc9d53c6c3e03e2cc
Gerrit-Change-Number: 35791
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>
Gerrit-MessageType: merged