Attention is currently required from: fixeria, lynxis lazus, pespin.
Hello Jenkins Builder, fixeria, lynxis lazus, pespin,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-sgsn/+/43958?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed: Code-Review-1 by pespin, Verified+1 by Jenkins Builder
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.
Related: OS#7095 Change-Id: Ia570b27a3670fed3aeb4779840292c5d216a1102 --- M src/sgsn/gprs_sndcp_xid.c 1 file changed, 106 insertions(+), 78 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/58/43958/2