From 18e8b39fcde77832382372ecbd98de955a132f7d Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Sat, 11 May 2019 04:22:55 +0700 Subject: [PATCH] libmsc/ran_msg_a.c: refactor ran_a_decode_lcls_notification() We basically need to make sure that one of two possible IEs is not NULL, while another is NULL (eXclusive OR). This can be done using at least two conditional branches. Change-Id: Ie0f9b5c1bbbfb744e0615da07d76037d91b0abc8 Fixes: CID#198444 Logically dead code --- src/libmsc/ran_msg_a.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/libmsc/ran_msg_a.c b/src/libmsc/ran_msg_a.c index da32a8499..21be8960e 100644 --- a/src/libmsc/ran_msg_a.c +++ b/src/libmsc/ran_msg_a.c @@ -375,13 +375,7 @@ static int ran_a_decode_lcls_notification(struct ran_dec *ran_dec, const struct struct ran_msg ran_dec_msg; /* Either §3.2.2.119 LCLS-BSS-Status or §3.2.2.120 LCLS-Break-Request shall be present */ - if ((!ie_lcls_bss_status && !ie_lcls_break_req) - || (ie_lcls_bss_status && ie_lcls_break_req)) { - LOG_RAN_A_DEC(ran_dec, LOGL_ERROR, "Ignoring broken LCLS Notification message\n"); - return -EINVAL; - } - - if (ie_lcls_bss_status) { + if (ie_lcls_bss_status && !ie_lcls_break_req) { ran_dec_msg = (struct ran_msg){ .msg_type = RAN_MSG_LCLS_STATUS, .msg_name = "BSSMAP LCLS Notification (LCLS Status)", @@ -391,9 +385,7 @@ static int ran_a_decode_lcls_notification(struct ran_dec *ran_dec, const struct }, }; return ran_decoded(ran_dec, &ran_dec_msg); - } - - if (ie_lcls_break_req) { + } else if (ie_lcls_break_req && !ie_lcls_bss_status) { ran_dec_msg = (struct ran_msg){ .msg_type = RAN_MSG_LCLS_BREAK_REQ, .msg_name = "BSSMAP LCLS Notification (LCLS Break Req)", @@ -404,6 +396,7 @@ static int ran_a_decode_lcls_notification(struct ran_dec *ran_dec, const struct return ran_decoded(ran_dec, &ran_dec_msg); } + LOG_RAN_A_DEC(ran_dec, LOGL_ERROR, "Ignoring broken LCLS Notification message\n"); return -EINVAL; }