From: "De Lara Guarch, Pablo" <pablo.de.lara.guarch@intel.com>
To: "Gajewski, AleksanderX" <aleksanderx.gajewski@intel.com>,
"Doherty, Declan" <declan.doherty@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
"Gajewski, AleksanderX" <aleksanderx.gajewski@intel.com>
Subject: Re: [dpdk-dev] [PATCH] app/test-crypto-perf: fix uninitialized scalar variable
Date: Thu, 9 Feb 2017 22:55:15 +0000 [thread overview]
Message-ID: <E115CCD9D858EF4F90C690B0DCB4D897476D7BB5@IRSMSX108.ger.corp.intel.com> (raw)
In-Reply-To: <1486459306-11496-1-git-send-email-aleksanderx.gajewski@intel.com>
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Aleksander
> Gajewski
> Sent: Tuesday, February 07, 2017 9:22 AM
> To: Doherty, Declan
> Cc: dev@dpdk.org; Gajewski, AleksanderX
> Subject: [dpdk-dev] [PATCH] app/test-crypto-perf: fix uninitialized scalar
> variable
>
> Fix problem with uninitialized nb_cryptodevs variable by
> initialize it with 0 value. Program could jump to err label
> without running cperf_initialize_cryptodev() function.
>
> Coverity issue: 141073
> Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test
> application")
>
> Signed-off-by: Aleksander Gajewski <aleksanderx.gajewski@intel.com>
> ---
> app/test-crypto-perf/main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c
> index 6c128d8..035021a 100644
> --- a/app/test-crypto-perf/main.c
> +++ b/app/test-crypto-perf/main.c
> @@ -264,7 +264,7 @@
>
> void *ctx[RTE_MAX_LCORE] = { };
>
> - int nb_cryptodevs;
> + int nb_cryptodevs = 0;
> uint8_t cdev_id, i;
> uint8_t enabled_cdevs[RTE_CRYPTO_MAX_DEVS] = { 0 };
>
> --
> 1.9.1
Actually, this fix is incomplete.
In a few lines below, we have these lines:
nb_cryptodevs = cperf_initialize_cryptodev(&opts, enabled_cdevs);
if (nb_cryptodevs < 1) {
RTE_LOG(ERR, USER1, "Failed to initialise requested crypto "
"device type\n");
goto err;
}
If cperf_initialize_cryptodev() returns -EINVAL, then, nb_cryptodevs will be negative,
which shouldn't be when going to err label.
I think "nb_cryptodevs = 0 " is necessary inside this conditional, before jumping to err.
Thanks,
Pablo
next prev parent reply other threads:[~2017-02-09 22:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-07 9:21 Aleksander Gajewski
2017-02-09 22:55 ` De Lara Guarch, Pablo [this message]
2017-02-10 9:22 ` [dpdk-dev] [PATCH v2] " Aleksander Gajewski
2017-02-10 9:47 ` De Lara Guarch, Pablo
2017-02-10 11:05 ` De Lara Guarch, Pablo
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=E115CCD9D858EF4F90C690B0DCB4D897476D7BB5@IRSMSX108.ger.corp.intel.com \
--to=pablo.de.lara.guarch@intel.com \
--cc=aleksanderx.gajewski@intel.com \
--cc=declan.doherty@intel.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).