From: Stephen Hemminger Date: Tue, 6 Nov 2018 19:30:05 +0000 (-0800) Subject: net/tap: fix file descriptor check X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=e0a10f4691c2fa74d228a1c21772456afef1e060;p=dpdk.git net/tap: fix file descriptor check Static analysis tools don't like the fact that fd could be zero in the error path. This won't happen in real world because stdin would have to be closed, then other error occurring. Coverity issue: 14079 Fixes: 02f96a0a82d1 ("net/tap: add TUN/TAP device PMD") Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger Acked-by: Keith Wiles --- diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index e7817e8961..75b82f2b3e 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -248,7 +248,7 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive) return fd; error: - if (fd > 0) + if (fd >= 0) close(fd); return -1; }