Compiling with clang --analyze
Hi, 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" 1.) 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. 2.) 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. cheers holger -- - Holger Freyther <hfreyther@sysmocom.de> http://www.sysmocom.de/ ======================================================================= * 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
hi holger, i commited fixes to these issues. i have not clang installed, so i could not test it, but is should be fixed. regards, andreas
participants (2)
-
Holger Hans Peter Freyther -
jolly