Change in osmo-bts[master]: Make gcc 11.1.0 false positivies happy

pespin gerrit-no-reply at lists.osmocom.org
Thu Jul 15 11:52:22 UTC 2021


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/24952 )


Change subject: Make gcc 11.1.0 false positivies happy
......................................................................

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 in a couple
places. Let's initialize those to make gcc happy.

"""
//git/osmo-bts/src/common/vty.c: In function ‘lchan_summary’:
//git/osmo-bts/src/common/vty.c:1881:23: error: ‘ts’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1881 |                 lchan = &ts->lchan[lchan_nr];
      |                 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~
//git/osmo-bts/src/common/vty.c:1869:20: error: ‘trx’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1869 |                 ts = &trx->ts[ts_nr];
      |                 ~~~^~~~~~~~~~~~~~~~~
//git/osmo-bts/src/common/vty.c:1852:34: error: ‘bts’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1852 |                 if (trx_nr >= bts->num_trx) {
"""

Change-Id: I93477142a5a4b3f3829b7398d6e564c127263596
---
M src/common/vty.c
1 file changed, 3 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/52/24952/1

diff --git a/src/common/vty.c b/src/common/vty.c
index 3065a90..a7d1e84 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -1828,9 +1828,9 @@
 			 void (*dump_cb)(struct vty *, const struct gsm_lchan *))
 {
 	const struct gsm_network *net = gsmnet_from_vty(vty);
-	const struct gsm_bts *bts;
-	const struct gsm_bts_trx *trx;
-	const struct gsm_bts_trx_ts *ts;
+	const struct gsm_bts *bts = NULL; /* initialize to avoid uninitialized false warnings on some gcc versions (11.1.0) */
+	const struct gsm_bts_trx *trx = NULL; /* initialize to avoid uninitialized false warnings on some gcc versions (11.1.0) */
+	const struct gsm_bts_trx_ts *ts = NULL; /* initialize to avoid uninitialized false warnings on some gcc versions (11.1.0) */
 	const struct gsm_lchan *lchan;
 	int bts_nr, trx_nr, ts_nr, lchan_nr;
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/24952
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I93477142a5a4b3f3829b7398d6e564c127263596
Gerrit-Change-Number: 24952
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/21e27cc4/attachment.htm>


More information about the gerrit-log mailing list