summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKuba Kozak <kubax.kozak@intel.com>2017-10-03 13:48:02 +0200
committerThomas Monjalon <thomas@monjalon.net>2017-10-14 00:38:35 +0200
commitab9cfe43c28efb3576396e7133af64b25b8785f3 (patch)
tree2e030d45000a659f2b2620ad35a123797fa0a49f
parent9b85b871cc52d1219f5a68131059e539f7ee9916 (diff)
downloaddpdk-ab9cfe43c28efb3576396e7133af64b25b8785f3.zip
dpdk-ab9cfe43c28efb3576396e7133af64b25b8785f3.tar.gz
dpdk-ab9cfe43c28efb3576396e7133af64b25b8785f3.tar.xz
examples/l3fwd-acl: check fseek return
Add return value check and error handling for fseek call. Coverity issue: 143435 Fixes: 361b2e9559fc ("acl: new sample l3fwd-acl") Signed-off-by: Kuba Kozak <kubax.kozak@intel.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com> Acked-by: Zhiyong Yang <zhiyong.yang@intel.com>
-rw-r--r--examples/l3fwd-acl/main.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c
index a7f9fff..4d263f1 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);