From: Stephen Hemminger <stephen@networkplumber.org>
To: Kamil Godzwon <kamilx.godzwon@intel.com>
Cc: dev@dpdk.org, Akhil Goyal <gakhil@marvell.com>,
Fan Zhang <fanzhang.oss@gmail.com>
Subject: Re: [PATCH v2] lib/cryptodev: fix assertion to remove GCC compilation warning
Date: Mon, 22 May 2023 14:25:10 -0700 [thread overview]
Message-ID: <20230522142510.3952adc5@hermes.local> (raw)
In-Reply-To: <20230522190453.453281-1-kamilx.godzwon@intel.com>
On Mon, 22 May 2023 15:04:52 -0400
Kamil Godzwon <kamilx.godzwon@intel.com> wrote:
> /home/vagrant/dpdk/build/include/rte_crypto_sym.h:1009:4: \
> warning: Value stored to 'left' is never read [deadcode.DeadStores]
> left = 0;
> ^ ~
> 1 warning generated.
>
> Compilator sees that the variable 'left' is never read after
> assignment a '0' value. To get rid of this warning message, use 'if'
> condition to verify the 'left' value before RTE_ASSERT.
>
> Signed-off-by: Kamil Godzwon <kamilx.godzwon@intel.com>
> ---
> v2:
> Changed commit message as the line was too long
> Removed braces
> ---
> lib/cryptodev/rte_crypto_sym.h | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h
> index b43174dbec..dcef1a5049 100644
> --- a/lib/cryptodev/rte_crypto_sym.h
> +++ b/lib/cryptodev/rte_crypto_sym.h
> @@ -1016,7 +1016,9 @@ rte_crypto_mbuf_to_vec(const struct rte_mbuf *mb, uint32_t ofs, uint32_t len,
> left -= seglen;
> }
>
> - RTE_ASSERT(left == 0);
> + if (left != 0)
> + RTE_ASSERT(false);
> +
> return i;
> }
>
This could happen if the passed in length to this routine was larger than
the amount of data in the mbuf. Should the function check and return an error?
Panic should only be reserved for seriously corrupted input (like invalid mbuf).
Also, this is a big enough function that it really should not be inlined.
next prev parent reply other threads:[~2023-05-22 21:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-22 18:49 [PATCH] " Kamil Godzwon
2023-05-22 19:04 ` [PATCH v2] " Kamil Godzwon
2023-05-22 21:25 ` Stephen Hemminger [this message]
2023-05-23 8:12 ` [EXT] " Akhil Goyal
2023-05-23 16:00 ` Stephen Hemminger
2023-05-24 7:21 ` Akhil Goyal
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=20230522142510.3952adc5@hermes.local \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=fanzhang.oss@gmail.com \
--cc=gakhil@marvell.com \
--cc=kamilx.godzwon@intel.com \
/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).