Attention is currently required from: fixeria, lynxis lazus, pespin.

dexter uploaded patch set #3 to this change.

View Change

The following approvals got outdated and were removed: Verified+1 by Jenkins Builder

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, 104 insertions(+), 74 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/58/43958/3

To view, visit change 43958. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newpatchset
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: Ia570b27a3670fed3aeb4779840292c5d216a1102
Gerrit-Change-Number: 43958
Gerrit-PatchSet: 3
Gerrit-Owner: dexter <pmaier@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: lynxis lazus <lynxis@fe80.eu>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>
Gerrit-Attention: pespin <pespin@sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Attention: lynxis lazus <lynxis@fe80.eu>