DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/nfp: check function return value
@ 2017-11-08 12:19 Alejandro Lucero
  2017-11-10  9:39 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
  0 siblings, 1 reply; 2+ messages in thread
From: Alejandro Lucero @ 2017-11-08 12:19 UTC (permalink / raw)
  To: dev; +Cc: stable

The fstat function could return a value that indicates an error condition.
If this is not checked, the error condition may not be handled correctly.

Fixes: f37d8a4b67b2 ("net/nfp: add NSP FW upload command")
Coverity: 195019

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
---
 drivers/net/nfp/nfp_nspu.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/nfp/nfp_nspu.c b/drivers/net/nfp/nfp_nspu.c
index 3c8cdad..39d14e6 100644
--- a/drivers/net/nfp/nfp_nspu.c
+++ b/drivers/net/nfp/nfp_nspu.c
@@ -341,7 +341,12 @@
 		return -ENOENT;
 	}
 
-	fstat(fw_f, &file_stat);
+	if (fstat(fw_f, &file_stat) < 0) {
+		RTE_LOG(INFO, PMD, "Firmware file %s/%s size is unknown",
+			DEFAULT_FW_PATH, DEFAULT_FW_FILENAME);
+		close(fw_f);
+		return -ENOENT;
+	}
 
 	fsize = file_stat.st_size;
 	RTE_LOG(DEBUG, PMD, "Firmware file with size: %" PRIu64 "\n",
-- 
1.9.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH] net/nfp: check function return value
  2017-11-08 12:19 [dpdk-dev] [PATCH] net/nfp: check function return value Alejandro Lucero
@ 2017-11-10  9:39 ` Ferruh Yigit
  0 siblings, 0 replies; 2+ messages in thread
From: Ferruh Yigit @ 2017-11-10  9:39 UTC (permalink / raw)
  To: Alejandro Lucero, dev; +Cc: stable

On 11/8/2017 4:19 AM, Alejandro Lucero wrote:
> The fstat function could return a value that indicates an error condition.
> If this is not checked, the error condition may not be handled correctly.
> 
> Fixes: f37d8a4b67b2 ("net/nfp: add NSP FW upload command")
> Coverity: 195019
> 
> Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>

Applied to dpdk/master, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-10  9:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-08 12:19 [dpdk-dev] [PATCH] net/nfp: check function return value Alejandro Lucero
2017-11-10  9:39 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).