diff options
author | Florin Coras <fcoras@cisco.com> | 2021-02-23 12:03:03 -0800 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2021-02-23 19:57:46 +0000 |
commit | d77325c0c43f270a1717d4d5b5acb94cdf674c1f (patch) | |
tree | f28a8272f3ebcbbfbfcac01579c1ff48647288a0 /src/vcl/vppcom.c | |
parent | c2a5ea0b8b41547d9567d35b93407c36b74c7465 (diff) |
vcl: fix coverity warning
Type: fix
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Id9f922eafe4a68661d2858d72fc548a372e9596a
Diffstat (limited to 'src/vcl/vppcom.c')
-rw-r--r-- | src/vcl/vppcom.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c index a439d2550a1..cc4464b162e 100644 --- a/src/vcl/vppcom.c +++ b/src/vcl/vppcom.c @@ -3637,16 +3637,18 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op, break; case VPPCOM_ATTR_GET_DOMAIN: - if (buffer && buflen && (*buflen >= sizeof (int))) + if (!(buffer && buflen && (*buflen >= sizeof (int)))) { - if (session->transport.is_ip4) - *(int *) buffer = AF_INET; - else - *(int *) buffer = AF_INET6; - *buflen = sizeof (int); + rv = VPPCOM_EINVAL; + break; } + + if (session->transport.is_ip4) + *(int *) buffer = AF_INET; else - rv = VPPCOM_EINVAL; + *(int *) buffer = AF_INET6; + *buflen = sizeof (int); + VDBG (2, "VPPCOM_ATTR_GET_DOMAIN: %d, buflen %u", *(int *) buffer, *buflen); break; |