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
This commit is contained in:
parent
65ff98684e
commit
ed483d190c
|
@ -134,11 +134,24 @@ int mgcp_send_dummy(struct mgcp_endpoint *endp)
|
|||
rc = mgcp_udp_send(endp->net_end.rtp.fd, &endp->net_end.addr,
|
||||
endp->net_end.rtp_port, buf, 1);
|
||||
|
||||
if (rc == -1 || endp->tcfg->omit_rtcp)
|
||||
if (rc == -1)
|
||||
goto failed;
|
||||
|
||||
if (endp->tcfg->omit_rtcp)
|
||||
return rc;
|
||||
|
||||
return mgcp_udp_send(endp->net_end.rtcp.fd, &endp->net_end.addr,
|
||||
endp->net_end.rtcp_port, buf, 1);
|
||||
rc = mgcp_udp_send(endp->net_end.rtcp.fd, &endp->net_end.addr,
|
||||
endp->net_end.rtcp_port, buf, 1);
|
||||
|
||||
if (rc >= 0)
|
||||
return rc;
|
||||
|
||||
failed:
|
||||
LOGP(DMGCP, LOGL_ERROR,
|
||||
"Failed to send dummy packet: %s on: 0x%x to %s\n",
|
||||
strerror(errno), ENDPOINT_NUMBER(endp), inet_ntoa(endp->net_end.addr));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int32_t compute_timestamp_aligment_error(struct mgcp_rtp_stream_state *sstate,
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue