laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31118 )
Change subject: Work around coverity false positives in macros ......................................................................
Work around coverity false positives in macros
We have some macros that may at times have signed arguments, and at other times unsigned. Checking for <= 0 is not a bug in this case. Let's typecast any unsigned arguments to signed int to work around.
Change-Id: I10e60b20c6f8092cf1ce09ebe501e739fd4a9479 Closes: CID#272993, CID#272992 (and many others) --- M include/osmocom/bsc/gsm_data.h 1 file changed, 16 insertions(+), 2 deletions(-)
Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index 44a9d5e..8c4dcce 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -495,9 +495,9 @@ * * These macros convert from n to the other representations: */ -#define ALG_A5_NR_TO_RSL(A5_N) ((A5_N) >= 0 ? (A5_N)+1 : 0) +#define ALG_A5_NR_TO_RSL(A5_N) ((int)(A5_N) >= 0 ? (A5_N)+1 : 0) #define ALG_A5_NR_TO_BSSAP(A5_N) ALG_A5_NR_TO_RSL(A5_N) -#define ALG_A5_NR_TO_PERM_ALG_BITS(A5_N) ((A5_N) >= 0 ? 1<<(A5_N) : 0) +#define ALG_A5_NR_TO_PERM_ALG_BITS(A5_N) ((int)(A5_N) >= 0 ? 1<<(A5_N) : 0)
/* Up to 16 SI2quater are multiplexed; each fits 3 EARFCNS, so the practical maximum is 3*16. * The real maximum that fits in a total of 16 SI2quater rest octets also depends on the bits left by other SI2quater