Change in osmo-bsc[master]: handover_test: fix ts_str may be uninitialized

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/.

osmith gerrit-no-reply at lists.osmocom.org
Mon Jul 12 09:21:15 UTC 2021


osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/24913 )


Change subject: handover_test: fix ts_str may be uninitialized
......................................................................

handover_test: fix ts_str may be uninitialized

Fix for:
  handover_test.c: In function 'res_ind':
  handover_test.c:1094:30: error: 'ts_str' may be used uninitialized in this function [-Werror=maybe-uninitialized]
       char subslot_val = ts_str[lchan->nr];

Fixes: f76424 ("RES IND: add test_resource_indication.ho_vty")
Change-Id: I398ba24b945bad96896eeb5ddbaff9c48bacf8ab
---
M tests/handover/handover_test.c
1 file changed, 2 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/13/24913/1

diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c
index 8d316ca..2c97f78 100644
--- a/tests/handover/handover_test.c
+++ b/tests/handover/handover_test.c
@@ -1077,7 +1077,7 @@
 
 	level = 0xff;
 	for (i = 0; i < ARRAY_SIZE(trx->ts); i++) {
-		const char *ts_str;
+		const char *ts_str = NULL;
 		struct gsm_lchan *lchan;
 		size_t given_subslots = 0;
 		struct gsm_bts_trx_ts *ts = &trx->ts[i];
@@ -1090,7 +1090,7 @@
 		ts_for_n_lchans(lchan, ts, ts->max_lchans_possible) {
 			int chan_nr;
 
-			if (lchan->nr < given_subslots) {
+			if (lchan->nr < given_subslots && ts_str) {
 				char subslot_val = ts_str[lchan->nr];
 				switch (subslot_val) {
 				case '-':

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I398ba24b945bad96896eeb5ddbaff9c48bacf8ab
Gerrit-Change-Number: 24913
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210712/62a444be/attachment.htm>


More information about the gerrit-log mailing list