On Tue, Aug 25, 2020 at 02:49:39AM +0000, scan-admin@coverity.com wrote:
*** CID 212862: Error handling issues (CHECKED_RETURN) /source-Osmocom/osmo-pcu/src/pdch.cpp: 211 in gprs_rlcmac_pdch::packet_paging_request()() 205 206 /* loop until message is full */ 207 while (pag) { 208 if (log_check_level(DRLCMAC, LOGL_DEBUG)) { 209 struct osmo_mobile_identity omi = {}; 210 char str[64];
CID 212862: Error handling issues (CHECKED_RETURN) Calling "osmo_mobile_identity_decode" without checking return value (as is done elsewhere 20 out of 22 times).211 osmo_mobile_identity_decode(&omi, pag->identity_lv + 1, pag->identity_lv[0], true); 212 osmo_mobile_identity_to_str_buf(str, sizeof(str), &omi); 213 LOGP(DRLCMAC, LOGL_DEBUG, "Paging MI - %s\n", str); 214 }
I'd like to let you guys know that I intentionally don't check the return value here. This is only for logging the mobile identity, and if decoding fails, the logging should just show "NONE".
~N
On Wed, Aug 26, 2020 at 02:23:03PM +0200, nhofmeyr@sysmocom.de wrote:
I'd like to let you guys know that I intentionally don't check the return value here. This is only for logging the mobile identity, and if decoding fails, the logging should just show "NONE".
AFAIR, there are ways how you can annotate the code in a way to avoid coverity raising it.
There should be something like //coverity[] but some people claim there is also the option of casting the return value to (void): https://stackoverflow.com/questions/5073164/coverity-prevent-how-to-handle-c...