aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2023-01-31 13:18:14 +0100
committerlaforge <laforge@osmocom.org>2023-02-27 10:12:13 +0000
commitc4b523a8f34fa3ff3bb1ceaab9d5703d5e575210 (patch)
tree486d4aaba74040e81b65a01ac521662bf918ae56 /include
parent4bcfb7e0342ac0ab956b559347548d6afda572b3 (diff)
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)
Diffstat (limited to 'include')
-rw-r--r--include/osmocom/bsc/gsm_data.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 44a9d5e05..8c4dcce35 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -495,9 +495,9 @@ struct om2k_mo {
*
* 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