aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2022-02-01 11:55:59 +0100
committerlaforge <laforge@osmocom.org>2022-02-01 16:59:52 +0000
commit7b4aea4aa6572c593ef0177f4d105944c2ca1713 (patch)
tree1c71debb8c5e38ad9c6826cb88d1d45eded3ee95
parentebccb824a04417eac4f595b0128c3a18e9589302 (diff)
xua_asp_fsm: Fix gcc false positive warning
As of GCC 11.1.0, it starts printing a warning about uninitialized variable. It is a false positive since tmode is really only used in the case where traffic_mode is not zero, in which case tmode is set. Let's restrict the scope of tmode to fix the issue and also make it clearer where the variable is used. """ In file included from /git/libosmo-sccp/src/xua_asp_fsm.c:25: /git/libosmo-sccp/src/xua_asp_fsm.c: In function ‘xua_asp_fsm_inactive’: /git/libosmo-sccp/include/osmocom/sigtran/osmo_ss7.h:274:16: error: ‘tmode’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 274 | return get_value_string(osmo_ss7_as_traffic_mode_vals, mode); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /git/libosmo-sccp/src/xua_asp_fsm.c:476:39: note: ‘tmode’ was declared here 476 | enum osmo_ss7_as_traffic_mode tmode; | """ Change-Id: I4fc38724aba3a3f178ba0b45444e1394db44d039
-rw-r--r--src/xua_asp_fsm.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c
index 5fe1d80..a93dbd2 100644
--- a/src/xua_asp_fsm.c
+++ b/src/xua_asp_fsm.c
@@ -473,7 +473,6 @@ static void xua_asp_fsm_inactive(struct osmo_fsm_inst *fi, uint32_t event, void
struct osmo_ss7_as *as;
struct xua_msg *xua_in;
uint32_t traf_mode = 0;
- enum osmo_ss7_as_traffic_mode tmode;
struct xua_msg_part *part;
int i;
@@ -515,7 +514,6 @@ static void xua_asp_fsm_inactive(struct osmo_fsm_inst *fi, uint32_t event, void
peer_send_error(fi, M3UA_ERR_UNSUPP_TRAF_MOD_TYP);
return;
}
- tmode = osmo_ss7_tmode_from_xua(traf_mode);
}
if ((part = xua_msg_find_tag(xua_in, M3UA_IEI_ROUTE_CTX))) {
for (i = 0; i < part->len / sizeof(uint32_t); i++) {
@@ -529,6 +527,7 @@ static void xua_asp_fsm_inactive(struct osmo_fsm_inst *fi, uint32_t event, void
}
if (traf_mode) { /* if the peer has specified a traffic mode at all */
+ enum osmo_ss7_as_traffic_mode tmode = osmo_ss7_tmode_from_xua(traf_mode);
llist_for_each_entry(as, &asp->inst->as_list, list) {
if (!osmo_ss7_as_has_asp(as, asp))
continue;