SCTP: coverity scan warnings
This patch addresses 182346, 182347, 182353.
Change-Id: I59c3d74bd3a2122b836c93e22ddb632fa032f7fe
Signed-off-by: Marco Varlese <marco.varlese@suse.com>
diff --git a/src/vnet/sctp/sctp_output.c b/src/vnet/sctp/sctp_output.c
index 8ce94c6..e2738e9 100644
--- a/src/vnet/sctp/sctp_output.c
+++ b/src/vnet/sctp/sctp_output.c
@@ -868,7 +868,7 @@
void
sctp_prepare_initack_chunk (sctp_connection_t * sctp_conn, u8 idx,
vlib_buffer_t * b, ip4_address_t * ip4_addr,
- ip6_address_t * ip6_addr)
+ u8 add_ip4, ip6_address_t * ip6_addr, u8 add_ip6)
{
vlib_main_t *vm = vlib_get_main ();
sctp_ipv4_addr_param_t *ip4_param = 0;
@@ -881,12 +881,12 @@
u16 alloc_bytes =
sizeof (sctp_init_ack_chunk_t) + sizeof (sctp_state_cookie_param_t);
- if (PREDICT_TRUE (ip4_addr != NULL))
+ if (PREDICT_FALSE (add_ip4 == 1))
{
/* Create room for variable-length fields in the INIT_ACK chunk */
alloc_bytes += SCTP_IPV4_ADDRESS_TYPE_LENGTH;
}
- if (PREDICT_TRUE (ip6_addr != NULL))
+ if (PREDICT_FALSE (add_ip6 == 1))
{
/* Create room for variable-length fields in the INIT_ACK chunk */
alloc_bytes += SCTP_IPV6_ADDRESS_TYPE_LENGTH;