Compiling with clang --analyze

Holger Hans Peter Freyther hfreyther at
Tue Jul 24 22:23:16 UTC 2012


one more email for tonight. Using clang/smatch from time to time
can highlight certain issues. The easiest way to invoke it is this:

$ make CC="clang --analyze" CXX="clang++ --analyze"

gprs_bssgp_pcu.cpp:241:6: warning: Access to field 'state' results in a dereference of a null pointer (loaded from variable 'bctx')
        if (bctx->state & BVC_S_BLOCKED && pdu_type != BSSGP_PDUT_STATUS)

the handling of bctx is a bit weird, in theory it can be NULL but
I am not sure if we are likely to receive the messages that would
make the PCU crash though. gprs_bssgp_pcu_rcvmsg can call the above
function/line with a NULL bctx.

gprs_rlcmac.cpp:728:25: warning: Assigned value is garbage or undefined
                                tbf->dir.ul.usf[ts] = usf[ts];
                                                    ^ ~~~~~~~
Probably true, alloc_algorithm_b is really too big to be readable to
verify that this is not a false positive.


- Holger Freyther <hfreyther at>
* sysmocom - systems for mobile communications GmbH
* Schivelbeiner Str. 5
* 10439 Berlin, Germany
* Sitz / Registered office: Berlin, HRB 134158 B
* Geschaeftsfuehrer / Managing Directors: Holger Freyther, Harald Welte

More information about the osmocom-net-gprs mailing list