Change in osmo-bsc[master]: smscb: fix meaningless condition in etws_primary_to_bts()
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/28088 ) Change subject: smscb: fix meaningless condition in etws_primary_to_bts() ...................................................................... smscb: fix meaningless condition in etws_primary_to_bts() Found by GCC 12.1.0: smscb.c: In function 'etws_primary_to_bts': smscb.c:537:13: warning: the comparison will always evaluate as 'true' for the address of 'warning_sec_info' will never be NULL [-Waddress] 537 | if (wrepl->u.emergency.warning_sec_info) { | ^~~~~ In file included from smscb.c:31: /usr/local/include/osmocom/gsm/cbsp.h:99:33: note: 'warning_sec_info' declared here 99 | uint8_t warning_sec_info[50]; | ^~~~~~~~~~~~~~~~ Indeed, address of &warning_sec_info[0] is always not NULL. Change-Id: Id369bb3676ba279bafc234378fbe21dbc7b0614b --- M src/osmo-bsc/smscb.c 1 file changed, 3 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/88/28088/1 diff --git a/src/osmo-bsc/smscb.c b/src/osmo-bsc/smscb.c index 8a6a705..b614852 100644 --- a/src/osmo-bsc/smscb.c +++ b/src/osmo-bsc/smscb.c @@ -534,11 +534,9 @@ bes->input.msg_id = wrepl->msg_id; bes->input.serial_nr = wrepl->new_serial_nr; bes->input.warn_type = wrepl->u.emergency.warning_type; - if (wrepl->u.emergency.warning_sec_info) { - bes->input.sec_info = talloc_named_const(bts, ETWS_SEC_INFO_SIZE, "etws_sec_info"); - if (bes->input.sec_info) - memcpy(bes->input.sec_info, wrepl->u.emergency.warning_sec_info, ETWS_SEC_INFO_SIZE); - } + bes->input.sec_info = talloc_named_const(bts, ETWS_SEC_INFO_SIZE, "etws_sec_info"); + if (bes->input.sec_info) + memcpy(bes->input.sec_info, wrepl->u.emergency.warning_sec_info, ETWS_SEC_INFO_SIZE); /* generate the encoded ETWS PN */ gen_etws_primary_notification(bes->primary, bes->input.serial_nr, bes->input.msg_id, -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/28088 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: Id369bb3676ba279bafc234378fbe21dbc7b0614b Gerrit-Change-Number: 28088 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de> Gerrit-MessageType: newchange
participants (1)
-
fixeria