fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/35794?usp=email )
Change subject: abis_nm: misc/cosmetic changes to abis_nm_sw_act_req_ack() ......................................................................
abis_nm: misc/cosmetic changes to abis_nm_sw_act_req_ack()
Change-Id: I2849a22647805e7477d66055c18614a3a9f80748 --- M include/osmocom/bsc/abis_nm.h M src/osmo-bsc/abis_nm.c 2 files changed, 17 insertions(+), 8 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/94/35794/1
diff --git a/include/osmocom/bsc/abis_nm.h b/include/osmocom/bsc/abis_nm.h index 7f1ec74..59a6dc9 100644 --- a/include/osmocom/bsc/abis_nm.h +++ b/include/osmocom/bsc/abis_nm.h @@ -86,7 +86,8 @@ int abis_nm_set_radio_attr(struct gsm_bts_trx *trx, uint8_t *attr, int attr_len); int abis_nm_set_channel_attr(struct gsm_bts_trx_ts *ts, uint8_t chan_comb); int abis_nm_sw_act_req_ack(struct gsm_bts *bts, uint8_t obj_class, uint8_t i1, - uint8_t i2, uint8_t i3, int nack, uint8_t *attr, int att_len); + uint8_t i2, uint8_t i3, int nack, + const uint8_t *attr, int attr_len); int abis_nm_raw_msg(struct gsm_bts *bts, int len, uint8_t *msg); int abis_nm_event_reports(struct gsm_bts *bts, int on); int abis_nm_reset_resource(struct gsm_bts *bts); diff --git a/src/osmo-bsc/abis_nm.c b/src/osmo-bsc/abis_nm.c index 81a0272..e8327dd 100644 --- a/src/osmo-bsc/abis_nm.c +++ b/src/osmo-bsc/abis_nm.c @@ -2164,12 +2164,13 @@ }
int abis_nm_sw_act_req_ack(struct gsm_bts *bts, uint8_t obj_class, uint8_t i1, - uint8_t i2, uint8_t i3, int nack, uint8_t *attr, int att_len) + uint8_t i2, uint8_t i3, int nack, + const uint8_t *attr, int attr_len) { struct abis_om_hdr *oh; struct msgb *msg = nm_msgb_alloc(); uint8_t msgtype = NM_MT_SW_ACT_REQ_ACK; - uint8_t len = att_len; + uint8_t len = attr_len;
if (nack) { len += 2; @@ -2177,12 +2178,10 @@ }
oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE); - fill_om_fom_hdr(oh, att_len, msgtype, obj_class, i1, i2, i3); + fill_om_fom_hdr(oh, attr_len, msgtype, obj_class, i1, i2, i3);
- if (attr) { - uint8_t *ptr = msgb_put(msg, att_len); - memcpy(ptr, attr, att_len); - } + if (attr != NULL && attr_len > 0) + memcpy(msgb_put(msg, attr_len), attr, attr_len); if (nack) msgb_tv_put(msg, NM_ATT_NACK_CAUSES, NM_NACK_OBJCLASS_NOTSUPP);