[dpdk-dev] [PATCH] acl: fix unchecked return value
Jastrzebski, MichalX K
michalx.k.jastrzebski at intel.com
Mon Oct 2 16:13:45 CEST 2017
> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Kuba Kozak
> Sent: Wednesday, September 20, 2017 12:02 PM
> To: Ananyev, Konstantin <konstantin.ananyev at intel.com>
> Cc: dev at dpdk.org; Kozak, KubaX <kubax.kozak at intel.com>;
> stable at dpdk.org
> Subject: [dpdk-dev] [PATCH] acl: fix unchecked return value
>
> Add return value check and error handling for fseek call.
>
> Coverity issue: 143435
> Fixes: 361b2e9559fc ("acl: new sample l3fwd-acl")
> Cc: konstantin.ananyev at intel.com
> Cc: stable at dpdk.org
>
> Signed-off-by: Kuba Kozak <kubax.kozak at 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
Hi Konstantin,
I would like to ask for a feedback regarding proposed fix.
If everything is ok with it, please send acked-by.
Best regards Michal.
More information about the dev
mailing list