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
This commit is contained in:
Vadim Yanitskiy 2024-02-03 06:36:53 +07:00 committed by Pau Espin Pedrol
parent 0368a9e815
commit a14b4a7379
1 changed files with 1 additions and 1 deletions

View File

@ -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);