This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/24953 ) Change subject: Make gcc 11.1.0 false positivies happy ...................................................................... Make gcc 11.1.0 false positivies happy After my system's gcc was upgraded, I get false positivies like the one below: """ /git/osmo-pcu/src/gprs_bssgp_pcu.c: In function ‘ns_configure_nse’: /git/osmo-pcu/src/gprs_bssgp_pcu.c:1103:58: error: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size 2 [-Werror=format-truncation=] 1103 | snprintf(name, sizeof(name), "pcu%d", i); | ^~ /git/osmo-pcu/src/gprs_bssgp_pcu.c:1103:54: note: directive argument in the range [-2147483648, 1] 1103 | snprintf(name, sizeof(name), "pcu%d", i); | ^~~~~~~ /git/osmo-pcu/src/gprs_bssgp_pcu.c:1103:25: note: ‘snprintf’ output between 5 and 15 bytes into a destination of size 5 1103 | snprintf(name, sizeof(name), "pcu%d", i); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ """ In this case, i can't never take a value with more than 1 digit, but gcc seems to be unable to see that. Let's increase the buffer size a few bytes to make gcc happy, and make the variable unsigned since it never will get negative values. Next change is also a false positive, since variables are always initialized beforehand in the cod epaths where they are used: """ /git/osmo-pcu/src/bts.cpp: In function ‘int bts_rcv_rach(gprs_rlcmac_bts*, const rach_ind_params*)’: /git/osmo-pcu/src/bts.cpp:859:25: error: ‘ts_no’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 859 | uint8_t trx_no, ts_no; | ^~~~~ /git/osmo-pcu/src/bts.cpp:859:17: error: ‘trx_no’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 859 | uint8_t trx_no, ts_no; | ^~~~~~ """ Change-Id: I1362a335a0c761bde367dbc779de4afa88f13584 --- M src/bts.cpp M src/gprs_bssgp_pcu.c 2 files changed, 5 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/53/24953/1 diff --git a/src/bts.cpp b/src/bts.cpp index 95dde04..ee6b915 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -856,7 +856,7 @@ struct chan_req_params chan_req = { 0 }; struct gprs_rlcmac_ul_tbf *tbf = NULL; struct gprs_rlcmac_sba *sba; - uint8_t trx_no, ts_no; + uint8_t trx_no = 0, ts_no = 0; /* initialize to avoid uninitialized false warnings on some gcc versions (11.1.0) */ uint32_t sb_fn = 0; uint8_t usf = 7; uint8_t tsc = 0; diff --git a/src/gprs_bssgp_pcu.c b/src/gprs_bssgp_pcu.c index 0e8e145..e2f6f51 100644 --- a/src/gprs_bssgp_pcu.c +++ b/src/gprs_bssgp_pcu.c @@ -1075,12 +1075,13 @@ const uint16_t *nsvci, uint16_t valid) { - int i, rc; + unsigned int i; + int rc; uint16_t binds = 0; bool nsvcs = false; struct gprs_ns2_vc *nsvc; struct gprs_ns2_vc_bind *bind[PCU_IF_NUM_NSVC] = { }; - char name[5]; + char name[16]; bool sns_configured = false; if (!valid) @@ -1100,7 +1101,7 @@ continue; if (!gprs_ns2_ip_bind_by_sockaddr(the_pcu->nsi, &local[i])) { - snprintf(name, sizeof(name), "pcu%d", i); + snprintf(name, sizeof(name), "pcu%u", i); rc = gprs_ns2_ip_bind(the_pcu->nsi, name, &local[i], 0, &bind[i]); if (rc < 0) { LOGP(DBSSGP, LOGL_ERROR, "Failed to bind to %s\n", osmo_sockaddr_to_str(&local[i])); -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/24953 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: I1362a335a0c761bde367dbc779de4afa88f13584 Gerrit-Change-Number: 24953 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210715/8dc8d52e/attachment.htm>