aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2019-05-11 03:52:28 +0700
committerHarald Welte <laforge@gnumonks.org>2019-05-13 20:15:04 +0000
commitbfe8eb76203a765d704c7a03228c04580660c1a4 (patch)
treef771cb76156f62f20bf99bd9557f9b5c47d1f45d
parent36c8153999483242deccacae490fdd15b55f3e95 (diff)
libmsc/ran_msg_a.c: avoid ternary operator in struct initialization
For some reason, having ternary operator there makes Coverity think that 'n->geran.chosen_encryption' is dereferenced before checking against NULL. Let's make it happy, and move the assignment. Change-Id: I95051d0f02e2fdd3ec8da3a506109e7b23e99b4b Fixes: CID#198454 Dereference before null check
-rw-r--r--src/libmsc/ran_msg_a.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/libmsc/ran_msg_a.c b/src/libmsc/ran_msg_a.c
index ba0990d84..da32a8499 100644
--- a/src/libmsc/ran_msg_a.c
+++ b/src/libmsc/ran_msg_a.c
@@ -1068,9 +1068,6 @@ struct msgb *ran_a_make_handover_request(struct osmo_fsm_inst *log_fi, const str
.speech_version_used = n->speech_version_used,
- .chosen_encryption_algorithm_serving =
- n->geran.chosen_encryption ? n->geran.chosen_encryption->alg_id : 0,
-
.old_bss_to_new_bss_info_raw = n->old_bss_to_new_bss_info_raw,
.old_bss_to_new_bss_info_raw_len = n->old_bss_to_new_bss_info_raw_len,
@@ -1098,6 +1095,7 @@ struct msgb *ran_a_make_handover_request(struct osmo_fsm_inst *log_fi, const str
memcpy(r.encryption_information.key,
n->geran.chosen_encryption->key, n->geran.chosen_encryption->key_len);
r.encryption_information.key_len = n->geran.chosen_encryption->key_len;
+ r.chosen_encryption_algorithm_serving = n->geran.chosen_encryption->alg_id;
}
if (n->classmark)