summaryrefslogtreecommitdiffstats
path: root/openbsc/tests/gsm0408/gsm0408_test.c
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-01-17 09:22:57 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-01-17 14:36:51 +0100
commit1dc022cb620e4e30953cfe72fe743431853df466 (patch)
treef022e6d13dd489ccb8cb04198a68053c7816dc9c /openbsc/tests/gsm0408/gsm0408_test.c
parentcaae10b71fb0ee752e199ccdc57dbede99db7c89 (diff)
openbsc: Fix coverity issues
This patch (hopefully) fixes the new defects reported by coverity. Addresses: ** CID 1156986: Negative array index read (NEGATIVE_RETURNS) /tests/gsm0408/gsm0408_test.c: 419 in test_si_range_helpers() /tests/gsm0408/gsm0408_test.c: 423 in test_si_range_helpers() /tests/gsm0408/gsm0408_test.c: 427 in test_si_range_helpers() ** CID 1156987: Unchecked return value from library (CHECKED_RETURN) /src/libmgcp/mgcp_protocol.c: 1150 in mgcp_keepalive_timer_cb() ** CID 1156988: Unchecked return value from library (CHECKED_RETURN) /src/libmgcp/mgcp_protocol.c: 983 in handle_modify_con() Sponsored-by: On-Waves ehf
Diffstat (limited to 'openbsc/tests/gsm0408/gsm0408_test.c')
-rw-r--r--openbsc/tests/gsm0408/gsm0408_test.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/openbsc/tests/gsm0408/gsm0408_test.c b/openbsc/tests/gsm0408/gsm0408_test.c
index 894eb0fb5..38c1a6a8c 100644
--- a/openbsc/tests/gsm0408/gsm0408_test.c
+++ b/openbsc/tests/gsm0408/gsm0408_test.c
@@ -416,15 +416,15 @@ static void test_si_range_helpers()
memset(&ws[0], 0x23, sizeof(ws));
i = range_enc_find_index(1023, freqs1, ARRAY_SIZE(freqs1));
- printf("Element is: %d => freqs[i] = %d\n", i, freqs1[i]);
+ printf("Element is: %d => freqs[i] = %d\n", i, i >= 0 ? freqs1[i] : -1);
VERIFY(i, ==, 2);
i = range_enc_find_index(511, freqs2, ARRAY_SIZE(freqs2));
- printf("Element is: %d => freqs[i] = %d\n", i, freqs2[i]);
+ printf("Element is: %d => freqs[i] = %d\n", i, i >= 0 ? freqs2[i] : -1);
VERIFY(i, ==, 2);
i = range_enc_find_index(511, freqs3, ARRAY_SIZE(freqs3));
- printf("Element is: %d => freqs[i] = %d\n", i, freqs3[i]);
+ printf("Element is: %d => freqs[i] = %d\n", i, i >= 0 ? freqs3[i] : -1);
VERIFY(i, ==, 0);
i = range_enc_arfcns(1023, freqs1, ARRAY_SIZE(freqs1), ws, 0);