From a14b4a73793f428ca11b57d4b58a4e474ad6c818 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Sat, 3 Feb 2024 06:36:53 +0700 Subject: [PATCH] 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 --- src/osmo-bsc/abis_nm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osmo-bsc/abis_nm.c b/src/osmo-bsc/abis_nm.c index 7a9789bc9..afb7abc6b 100644 --- a/src/osmo-bsc/abis_nm.c +++ b/src/osmo-bsc/abis_nm.c @@ -2183,7 +2183,7 @@ int abis_nm_sw_act_req_ack(struct gsm_bts *bts, uint8_t obj_class, uint8_t i1, } 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);