Attention is currently required from: osmith.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc-nat/+/28582 )
Change subject: bssap_conn: fix missing length check
......................................................................
Patch Set 3:
(3 comments)
File src/osmo-bsc-nat/bssap_conn.c:
https://gerrit.osmocom.org/c/osmo-bsc-nat/+/28582/comment/d03238c6_6c54670b
PS3, Line 56: enc_err = gsm0808_enc_aoip_trasp_addr(msg_new, ss) == 0;
Better add paraenthesis it's clearer: enc_err = (gsm0808_enc_aoip_trasp_addr(msg_new, ss) == 0);
https://gerrit.osmocom.org/c/osmo-bsc-nat/+/28582/comment/8389d2c5_33481adb
PS3, Line 61: enc_err = tlv_encode_one(msg_new, def->def[tag].type, tag, len_v, val) < 0;
Same, paranthesis, otherwise it's easy tonot see the comparision at the end (it happened to me).
https://gerrit.osmocom.org/c/osmo-bsc-nat/+/28582/comment/63be6e8f_e55a28d4
PS3, Line 64: if (enc_err) {
BTW, this looks to me a like a good candidate for goto.
at the end of function:
"""
enc_err:
LOGP(DMAIN, LOGL_ERROR, "Failed to encode tag %d into copy of bssmap msg\n", tag);
msgb_free(msg_new);
return -EINVAL;
"""
Then in all those places above, simply do "goto enc_err;", paths will become a lot simplet and cleaner imho.
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc-nat/+/28582
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc-nat
Gerrit-Branch: master
Gerrit-Change-Id: I1fc4c81e139bab3d7d977ef9467f62d8088884db
Gerrit-Change-Number: 28582
Gerrit-PatchSet: 3
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: osmith <osmith(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 05 Aug 2022 11:25:06 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment