lchan->s and integer overflow

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.de
Tue Mar 12 12:24:44 UTC 2013


On Tue, Mar 12, 2013 at 10:13:01AM +0100, jolly wrote:

dear jolly,


> + /* count up radio link counter S */
> + lchan->s += 2;
> + if (lchan->s > btsb->radio_link_timeout)
> + lchan->s = btsb->radio_link_timeout;

that is what I was missing when browsing the code in gtik. I think
there is a small glitch the other way around.

a.) We get criteria value == 0 through OML (for whatever reason)

+               btsb->radio_link_timeout = val[1]

b.) lchan_activate sets lchan->s == 0

+       lchan->s = btsb->radio_link_timeout;

c.) lchan->s -= 1

+                       /* count down radio link counter S */
+                       lchan->s--;

d.) if (lchan->s == 0)

Will not be true as the lchan->s is -1. Is it intended that setting a
'0' will disable the link failure checking?

kind regards
	holger




More information about the OpenBSC mailing list