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

osmith gerrit-no-reply at lists.osmocom.org
Mon Jul 12 12:06:28 UTC 2021


osmith has submitted this change. ( 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(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  daniel: Looks good to me, approved



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-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210712/edb431df/attachment.htm>


More information about the gerrit-log mailing list