From: Alejandro Lucero Date: Mon, 8 Apr 2019 09:20:40 +0000 (+0100) Subject: net/nfp: fix file descriptor check X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=0c08589d9eeaef341e154b2ddbc29699dbd16e17;p=dpdk.git net/nfp: fix file descriptor check Although it is rather unlikely getting 0 as the descriptor handle, better to contemplate that possibility. Coverity issue: 195018 Fixes: 896c265ef954 ("net/nfp: use new CPP interface") Cc: stable@dpdk.org Signed-off-by: Alejandro Lucero --- diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index 3e6178c7b2..50058e0564 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -3491,7 +3491,7 @@ nfp_fw_upload(struct rte_pci_device *dev, struct nfp_nsp *nsp, char *card) PMD_DRV_LOG(DEBUG, "Trying with fw file: %s", fw_name); fw_f = open(fw_name, O_RDONLY); - if (fw_f > 0) + if (fw_f >= 0) goto read_fw; /* Then try the PCI name */ @@ -3500,7 +3500,7 @@ nfp_fw_upload(struct rte_pci_device *dev, struct nfp_nsp *nsp, char *card) PMD_DRV_LOG(DEBUG, "Trying with fw file: %s", fw_name); fw_f = open(fw_name, O_RDONLY); - if (fw_f > 0) + if (fw_f >= 0) goto read_fw; /* Finally try the card type and media */