From: David Marchand <david.marchand@redhat.com>
To: stable@dpdk.org
Cc: bluca@debian.org, Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH 20.11 2/4] net/ena: fix build with GCC 12
Date: Thu, 8 Dec 2022 15:49:08 +0100 [thread overview]
Message-ID: <20221208144910.360883-2-david.marchand@redhat.com> (raw)
In-Reply-To: <20221208144910.360883-1-david.marchand@redhat.com>
[ upstream commit 2449949584667fbb275df1ea5a5ceeead1a65786 ]
GCC 12 raises the following warning:
In file included from ../lib/mempool/rte_mempool.h:46,
from ../lib/mbuf/rte_mbuf.h:38,
from ../lib/net/rte_ether.h:22,
from ../drivers/net/ena/ena_ethdev.h:10,
from ../drivers/net/ena/ena_rss.c:6:
../drivers/net/ena/ena_rss.c: In function ‘ena_rss_key_fill’:
../lib/eal/x86/include/rte_memcpy.h:370:9: warning: array subscript 64 is
outside array bounds of ‘uint8_t[40]’
{aka ‘unsigned char[40]’} [-Warray-bounds]
370 | rte_mov32((uint8_t *)dst + 2 * 32, (const uint8_t *)src + 2 * 32);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../drivers/net/ena/ena_rss.c:51:24: note: while referencing ‘default_key’
51 | static uint8_t default_key[ENA_HASH_KEY_SIZE];
| ^~~~~~~~~~~
This is a false positive because the copied size is checked against
ENA_HASH_KEY_SIZE in a (build) assert.
Silence this warning by calling memcpy with the minimal size.
Bugzilla ID: 849
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
Note on backport:
- moved change to ena_ethdev.c,
---
drivers/net/ena/ena_ethdev.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index a4aac5a892..aa2b52ed47 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -292,15 +292,14 @@ void ena_rss_key_fill(void *key, size_t size)
static uint8_t default_key[ENA_HASH_KEY_SIZE];
size_t i;
- RTE_ASSERT(size <= ENA_HASH_KEY_SIZE);
-
if (!key_generated) {
- for (i = 0; i < ENA_HASH_KEY_SIZE; ++i)
+ for (i = 0; i < RTE_DIM(default_key); ++i)
default_key[i] = rte_rand() & 0xff;
key_generated = true;
}
- rte_memcpy(key, default_key, size);
+ RTE_ASSERT(size <= sizeof(default_key));
+ rte_memcpy(key, default_key, RTE_MIN(size, sizeof(default_key)));
}
static inline void ena_trigger_reset(struct ena_adapter *adapter,
--
2.38.1
next prev parent reply other threads:[~2022-12-08 14:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-08 14:49 [PATCH 20.11 1/4] net/ena: remove useless address check David Marchand
2022-12-08 14:49 ` David Marchand [this message]
2022-12-08 14:49 ` [PATCH 20.11 3/4] net/qede: fix minsize build David Marchand
2022-12-08 14:49 ` [PATCH 20.11 4/4] crypto/ipsec_mb: fix build with GCC 12 David Marchand
2022-12-08 16:55 ` [PATCH 20.11 1/4] net/ena: remove useless address check Luca Boccassi
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=20221208144910.360883-2-david.marchand@redhat.com \
--to=david.marchand@redhat.com \
--cc=bluca@debian.org \
--cc=stable@dpdk.org \
--cc=stephen@networkplumber.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).