DPDK patches and discussions
 help / color / mirror / Atom feed
From: Sameer Vaze <svaze@qti.qualcomm.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, Sameer Vaze <svaze@qti.qualcomm.com>
Subject: Re: [PATCH] app/compress-perf: fix coverity issue
Date: Tue, 28 Oct 2025 17:20:02 +0000	[thread overview]
Message-ID: <SJ2PR02MB9795341842DF1C4B70F7B32D89FDA@SJ2PR02MB9795.namprd02.prod.outlook.com> (raw)
In-Reply-To: <20251024184745.1698409-1-svaze@qti.qualcomm.com>

[-- Attachment #1: Type: text/plain, Size: 3699 bytes --]

Recheck-request: rebase=main, github-robot, iol-sample-apps-testing, iol-compile-amd64-testing
________________________________
From: Sameer Vaze <svaze@qti.qualcomm.com>
Sent: Friday, October 24, 2025 12:47 PM
Cc: dev@dpdk.org <dev@dpdk.org>; Sameer Vaze <svaze@qti.qualcomm.com>
Subject: [PATCH] app/compress-perf: fix coverity issue

Removes possible assignment of a signed value
to an unsigned parameter. Also makes dictionary
an optional argument

Signed-off-by: Sameer Vaze <svaze@qti.qualcomm.com>
---
 .../comp_perf_options_parse.c                 |  2 +-
 app/test-compress-perf/main.c                 | 19 +++++++++++++------
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-compress-perf/comp_perf_options_parse.c
index 49197dc290..16d31c7e90 100644
--- a/app/test-compress-perf/comp_perf_options_parse.c
+++ b/app/test-compress-perf/comp_perf_options_parse.c
@@ -660,7 +660,7 @@ static struct option lgopts[] = {
         { CPERF_LEVEL, required_argument, 0, 0 },
         { CPERF_WINDOW_SIZE, required_argument, 0, 0 },
         { CPERF_EXTERNAL_MBUFS, 0, 0, 0 },
-       { CPERF_DICTIONARY, required_argument, 0, 0 },
+       { CPERF_DICTIONARY, optional_argument, 0, 0 },
         { CPERF_CYCLECOUNT_DELAY_US, required_argument, 0, 0 },
         { NULL, 0, 0, 0 }
 };
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index 11b016069c..59af073f12 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -355,16 +355,22 @@ comp_perf_dump_dictionary_data(struct comp_test_data *test_data)
                 RTE_LOG(ERR, USER1, "Size of input could not be calculated\n");
                 goto end;
         }
-       size_t actual_file_sz = ftell(f);
+       long file_sz = ftell(f);
         /* If extended input data size has not been set,
          * input data size = file size
          */

+       if (file_sz < 0) {
+               RTE_LOG(ERR, USER1, "Actual file size could not be determined\n");
+               goto end;
+       }
+
+       size_t actual_file_sz = (size_t)file_sz;
+
         if (test_data->dictionary_data_sz == 0)
                 test_data->dictionary_data_sz = actual_file_sz;

-       if (test_data->dictionary_data_sz <= 0 || actual_file_sz <= 0 ||
-                       fseek(f, 0, SEEK_SET) != 0) {
+       if (fseek(f, 0, SEEK_SET) != 0) {
                 RTE_LOG(ERR, USER1, "Size of input could not be calculated\n");
                 goto end;
         }
@@ -386,11 +392,15 @@ comp_perf_dump_dictionary_data(struct comp_test_data *test_data)

                 if (fread(data, data_to_read, 1, f) != 1) {
                         RTE_LOG(ERR, USER1, "Input file could not be read\n");
+                       if (test_data->dictionary_data)
+                               rte_free(test_data->dictionary_data);
                         goto end;
                 }
                 if (fseek(f, 0, SEEK_SET) != 0) {
                         RTE_LOG(ERR, USER1,
                                 "Size of input could not be calculated\n");
+                       if (test_data->dictionary_data)
+                               rte_free(test_data->dictionary_data);
                         goto end;
                 }
                 remaining_data -= data_to_read;
@@ -414,9 +424,6 @@ comp_perf_dump_dictionary_data(struct comp_test_data *test_data)
         if (f)
                 fclose(f);

-       if (test_data->dictionary_data)
-               rte_free(test_data->dictionary_data);
-
         return ret;
 }

--
2.31.1


[-- Attachment #2: Type: text/html, Size: 8311 bytes --]

  reply	other threads:[~2025-10-28 17:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-24 18:47 Sameer Vaze
2025-10-28 17:20 ` Sameer Vaze [this message]
2025-10-24 19:11 Sameer Vaze

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SJ2PR02MB9795341842DF1C4B70F7B32D89FDA@SJ2PR02MB9795.namprd02.prod.outlook.com \
    --to=svaze@qti.qualcomm.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).