summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjohny <jan.cavojsky@pantheon.tech>2019-12-06 13:58:35 +0100
committerAndrew Yourtchenko <ayourtch@gmail.com>2020-08-12 07:43:14 +0000
commitb04bdd12e67c084a02ad6179c1e83173bee709b4 (patch)
tree0a4ac74caa9f4fab0f52a4c58696796ced872829
parent3d3c4f0491be05119d936188c6a6f84de3203fe4 (diff)
ip: coverity fix
Delete Null-checking "p0" in function ip6_tcp_udp_icmp_bad_length, because it's not necessary. Type: fix Signed-off-by: johny <jan.cavojsky@pantheon.tech> Change-Id: I2bf43a60c1c1d76e42581df27f2285c9e9563093 (cherry picked from commit a633a4318bea2f9edcb80d9685b0f811cac679ea)
-rw-r--r--src/vnet/ip/ip6_forward.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c
index 574b94d939c..21fc76e2976 100644
--- a/src/vnet/ip/ip6_forward.c
+++ b/src/vnet/ip/ip6_forward.c
@@ -1161,15 +1161,13 @@ ip6_tcp_udp_icmp_bad_length (vlib_main_t * vm, vlib_buffer_t * p0)
payload_length_host_byte_order = clib_net_to_host_u16 (ip0->payload_length);
n_bytes_left = n_this_buffer = payload_length_host_byte_order;
- if (p0)
+
+ u32 n_ip_bytes_this_buffer =
+ p0->current_length - (((u8 *) ip0 - p0->data) - p0->current_data);
+ if (n_this_buffer + headers_size > n_ip_bytes_this_buffer)
{
- u32 n_ip_bytes_this_buffer =
- p0->current_length - (((u8 *) ip0 - p0->data) - p0->current_data);
- if (n_this_buffer + headers_size > n_ip_bytes_this_buffer)
- {
- n_this_buffer = p0->current_length > headers_size ?
- n_ip_bytes_this_buffer - headers_size : 0;
- }
+ n_this_buffer = p0->current_length > headers_size ?
+ n_ip_bytes_this_buffer - headers_size : 0;
}
n_bytes_left -= n_this_buffer;