[M] Change in libosmo-gprs[master]: gprs_sndcp_xid: replace OSMO_ASSERT with if and return
Attention is currently required from: osmith, pespin. Hello osmith, pespin, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmo-gprs/+/43996?usp=email to look at the new patch set (#2). Change subject: gprs_sndcp_xid: replace OSMO_ASSERT with if and return ...................................................................... gprs_sndcp_xid: replace OSMO_ASSERT with if and return The code around the function gprs_sndcp_compile_xid was written under the assumption that the caller always supplies correct input parameters because the caller has 100% control over the input. However, this is a high standard and depending on how the input is obtained errors may happen. In case of an error, the whole process will crash due to the usage of OSMO_ASSERT. When looking at the callers of gprs_sndcp_compile_xid, we can see that they already check the return code. Also the return type of gprs_sndcp_compile_xid is already int. We also do not have any dynamically allocated memory. There is nothing that would speak against returning a negative error code. Let's replace each occurrence of OSMO_ASSERT with an if and return an error code to the caller, so that the caller can handle the problem gracefully. This patch has been ported from: osmo-sgsn.git Ia570b27a3670fed3aeb4779840292c5d216a1102 Related: OS#7095 Change-Id: I834ceedf364f280881f8ac9f94edeae922527dde --- M src/sndcp/sndcp_xid.c 1 file changed, 104 insertions(+), 74 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/96/43996/2 -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/43996?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: I834ceedf364f280881f8ac9f94edeae922527dde Gerrit-Change-Number: 43996 Gerrit-PatchSet: 2 Gerrit-Owner: dexter <pmaier@sysmocom.de> Gerrit-Reviewer: osmith <osmith@sysmocom.de> Gerrit-Reviewer: pespin <pespin@sysmocom.de> Gerrit-CC: Jenkins Builder Gerrit-Attention: osmith <osmith@sysmocom.de> Gerrit-Attention: pespin <pespin@sysmocom.de>
participants (1)
-
dexter