net/ena: fix build with GCC 12
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 Cc: stable@dpdk.org Signed-off-by: David Marchand <david.marchand@redhat.com> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
parent
468f31eb71
commit
2449949584
@ -51,15 +51,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)));
|
||||
}
|
||||
|
||||
int ena_rss_reta_update(struct rte_eth_dev *dev,
|
||||
|
Loading…
Reference in New Issue
Block a user