Attention is currently required from: osmith, pespin.

dexter uploaded patch set #2 to this change.

View Change

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 change 43996. To unsubscribe, or for help writing mail filters, visit settings.

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>