From: Andrew Yourtchenko Date: Mon, 18 Nov 2019 10:37:24 +0000 (+0000) Subject: map: fix coverity issue 205684 X-Git-Tag: v20.05-rc0~360 X-Git-Url: https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commitdiff_plain;h=360b523b52a91bd0d1d7de1247141367c484d70f map: fix coverity issue 205684 ip4_map_get_domain returns d0 = 0 in case of no domain, and sets error MAP_ERROR_NO_DOMAIN. Rearrange the clauses in the logical check that relies on dereferencing d0 such that boolean shortcutting takes care of not referencing the null pointer. Change-Id: I378adc120836ea920fc530808ac3c1f98ab8d593 Type: fix Signed-off-by: Andrew Yourtchenko --- diff --git a/src/plugins/map/ip6_map.c b/src/plugins/map/ip6_map.c index 47958f92a38..899371effdf 100644 --- a/src/plugins/map/ip6_map.c +++ b/src/plugins/map/ip6_map.c @@ -618,8 +618,8 @@ ip6_map_post_ip4_reass (vlib_main_t * vm, MAP_ERROR_DECAP_SEC_CHECK; if (PREDICT_FALSE - (d0->mtu && (clib_host_to_net_u16 (ip40->length) > d0->mtu) - && error0 == MAP_ERROR_NONE)) + (error0 == MAP_ERROR_NONE && + d0->mtu && (clib_host_to_net_u16 (ip40->length) > d0->mtu))) { vnet_buffer (p0)->ip_frag.flags = 0; vnet_buffer (p0)->ip_frag.next_index = IP_FRAG_NEXT_IP4_LOOKUP;