patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] acl: fix unchecked return value
@ 2017-09-20 10:01 Kuba Kozak
  2017-10-02 14:13 ` [dpdk-stable] [dpdk-dev] " Jastrzebski, MichalX K
  2017-10-02 14:21 ` [dpdk-stable] " Ananyev, Konstantin
  0 siblings, 2 replies; 4+ messages in thread
From: Kuba Kozak @ 2017-09-20 10:01 UTC (permalink / raw)
  To: konstantin.ananyev; +Cc: dev, Kuba Kozak, stable

Add return value check and error handling for fseek call.

Coverity issue: 143435
Fixes: 361b2e9559fc ("acl: new sample l3fwd-acl")
Cc: konstantin.ananyev@intel.com
Cc: stable@dpdk.org

Signed-off-by: Kuba Kozak <kubax.kozak@intel.com>
---
 examples/l3fwd-acl/main.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c
index 8eff4de..708e9eb 100644
--- a/examples/l3fwd-acl/main.c
+++ b/examples/l3fwd-acl/main.c
@@ -1026,6 +1026,7 @@ add_rules(const char *rule_path,
 	char buff[LINE_MAX];
 	FILE *fh = fopen(rule_path, "rb");
 	unsigned int i = 0;
+	int val;
 
 	if (fh == NULL)
 		rte_exit(EXIT_FAILURE, "%s: Open %s failed\n", __func__,
@@ -1042,7 +1043,11 @@ add_rules(const char *rule_path,
 		rte_exit(EXIT_FAILURE, "Not find any route entries in %s!\n",
 				rule_path);
 
-	fseek(fh, 0, SEEK_SET);
+	val = fseek(fh, 0, SEEK_SET);
+	if (val < 0) {
+		rte_exit(EXIT_FAILURE, "%s: File seek operation failed\n",
+			__func__);
+	}
 
 	acl_rules = calloc(acl_num, rule_size);
 
-- 
2.7.4

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-20 10:01 [dpdk-stable] [PATCH] acl: fix unchecked return value Kuba Kozak
2017-10-02 14:13 ` [dpdk-stable] [dpdk-dev] " Jastrzebski, MichalX K
2017-10-02 14:21 ` [dpdk-stable] " Ananyev, Konstantin
2017-10-03 11:39   ` Kozak, KubaX

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).