This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.
Holger Hans Peter Freyther holger at freyther.deOn Wed, Apr 16, 2014 at 02:06:22PM +0200, Alvaro Neira Ayuso wrote: > +/* > + * In succesfully case, this function set again the pointers of the l2h and l3h > + * of the OML message that we have received. In other case, we don't set the > + * pointers of l2h and l3h > + */ > +static int check_oml_msg(struct msgb *msg) > +{ > + msg->l2h = msg->data; ... > + if (msg->len < abis_oml_hdr_len) > + return -1; > + > + msg->l3h = msg->data + sizeof(struct abis_om_hdr); > + if (omh->mdisc != ABIS_OM_MDISC_FOM) > + return -1; Code and comment do not match. This is why I asked you to say that in the error case the behavior is undefined. The other option would be to re-set l2h/l3h to NULL to make the code match your description. In terms of structure I had thought of a documentation like this: /** * \brief Check that the data in \param msg is a proper OML message * * This function verifies that the data in \param in msg is a proper * OML message and can be handled by later functions. In the successful * case the msg->l2h will now point to the OML header and the msg->l3h * will point to the FOM header. The value of l2h/l3h is undefined in * case the verification of the \param msg is failing. * * \param msg The message to analyze. msg->len starting from msg->data * will be analyzed. * \return This function returns X on success and Y on failure. */