aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Varlese <marco.varlese@suse.com>2018-02-06 17:31:06 +0100
committerDamjan Marion <dmarion.lists@gmail.com>2018-02-07 13:46:15 +0000
commitf429a93d95c73bafdc7244799703abc051127ca8 (patch)
tree872fd74afcfbd6fb331aac8d5996840fb752e931
parent5dca5465f5c31c3b887e9e2341878d4f97a4a6f8 (diff)
SCTP: address coverity-scan warnings
Change-Id: Iba7c398a398e24b96eb536bbcefa841bd153a205 Signed-off-by: Marco Varlese <marco.varlese@suse.com>
-rw-r--r--src/vnet/sctp/sctp_input.c26
-rw-r--r--src/vnet/sctp/sctp_output.c3
2 files changed, 10 insertions, 19 deletions
diff --git a/src/vnet/sctp/sctp_input.c b/src/vnet/sctp/sctp_input.c
index 66536884482..7d5e7555af5 100644
--- a/src/vnet/sctp/sctp_input.c
+++ b/src/vnet/sctp/sctp_input.c
@@ -432,8 +432,6 @@ sctp_handle_init_ack (sctp_header_t * sctp_hdr,
{
sctp_init_ack_chunk_t *init_ack_chunk =
(sctp_init_ack_chunk_t *) (sctp_hdr);
- ip4_address_t *ip4_addr = 0;
- ip6_address_t *ip6_addr = 0;
sctp_state_cookie_param_t state_cookie;
char hostname[FQDN_MAX_LENGTH];
@@ -483,8 +481,6 @@ sctp_handle_init_ack (sctp_header_t * sctp_hdr,
{
sctp_ipv4_addr_param_t *ipv4 =
(sctp_ipv4_addr_param_t *) opt_params_hdr;
- clib_memcpy (ip4_addr, &ipv4->address,
- sizeof (ip4_address_t));
sctp_sub_connection_add_ip4 (vlib_get_thread_index (), ipv4);
@@ -494,8 +490,6 @@ sctp_handle_init_ack (sctp_header_t * sctp_hdr,
{
sctp_ipv6_addr_param_t *ipv6 =
(sctp_ipv6_addr_param_t *) opt_params_hdr;
- clib_memcpy (ip6_addr, &ipv6->address,
- sizeof (ip6_address_t));
sctp_sub_connection_add_ip6 (vlib_get_thread_index (), ipv6);
@@ -888,12 +882,6 @@ sctp46_rcv_phase_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
if (PREDICT_FALSE (sctp_conn == 0))
{
- error0 = SCTP_ERROR_INVALID_CONNECTION;
- goto drop;
- }
-
- if (PREDICT_FALSE (sctp_conn == 0))
- {
SCTP_ADV_DBG
("sctp_conn == NULL; return SCTP_ERROR_INVALID_CONNECTION");
error0 = SCTP_ERROR_INVALID_CONNECTION;
@@ -1329,10 +1317,14 @@ sctp46_shutdown_phase_inline (vlib_main_t * vm,
{
sctp_trace =
vlib_add_trace (vm, node, b0, sizeof (*sctp_trace));
- clib_memcpy (&sctp_trace->sctp_header, sctp_hdr,
- sizeof (sctp_trace->sctp_header));
- clib_memcpy (&sctp_trace->sctp_connection, sctp_conn,
- sizeof (sctp_trace->sctp_connection));
+
+ if (sctp_hdr != NULL)
+ clib_memcpy (&sctp_trace->sctp_header, sctp_hdr,
+ sizeof (sctp_trace->sctp_header));
+
+ if (sctp_conn != NULL)
+ clib_memcpy (&sctp_trace->sctp_connection, sctp_conn,
+ sizeof (sctp_trace->sctp_connection));
}
b0->error = node->errors[error0];
@@ -2238,7 +2230,7 @@ do { \
* _(SHUTDOWN_RECEIVED, "SHUTDOWN_RECEIVED") \
* _(SHUTDOWN_ACK_SENT, "SHUTDOWN_ACK_SENT")
*/
- //_(CLOSED, DATA, SCTP_INPUT_NEXT_LISTEN_PHASE, SCTP_ERROR_NONE); /* UNEXPECTED DATA chunk which requires special handling */
+ _(CLOSED, DATA, SCTP_INPUT_NEXT_LISTEN_PHASE, SCTP_ERROR_NONE); /* UNEXPECTED DATA chunk which requires special handling */
_(CLOSED, INIT, SCTP_INPUT_NEXT_LISTEN_PHASE, SCTP_ERROR_NONE);
_(CLOSED, INIT_ACK, SCTP_INPUT_NEXT_DROP, SCTP_ERROR_ACK_DUP); /* UNEXPECTED INIT_ACK chunk */
_(CLOSED, SACK, SCTP_INPUT_NEXT_DROP, SCTP_ERROR_SACK_CHUNK_VIOLATION); /* UNEXPECTED SACK chunk */
diff --git a/src/vnet/sctp/sctp_output.c b/src/vnet/sctp/sctp_output.c
index 3ec54dc6c1a..ef5d3b72968 100644
--- a/src/vnet/sctp/sctp_output.c
+++ b/src/vnet/sctp/sctp_output.c
@@ -680,8 +680,7 @@ sctp_prepare_initack_chunk (sctp_connection_t * sctp_conn, vlib_buffer_t * b,
if (PREDICT_TRUE (ip6_addr != NULL))
{
sctp_ipv6_addr_param_t *ipv6_addr =
- (sctp_ipv6_addr_param_t *) init_ack_chunk +
- sizeof (sctp_init_chunk_t) + pointer_offset;
+ (sctp_ipv6_addr_param_t *) init_ack_chunk + pointer_offset;
ipv6_addr->param_hdr.type =
clib_host_to_net_u16 (SCTP_IPV6_ADDRESS_TYPE);