1 Star 0 Fork 72

叶青龙/dpdk

forked from src-openEuler/dpdk 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0318-net-ena-fix-build-with-GCC-12.patch 2.30 KB
一键复制 编辑 原始数据 按行查看 历史
jinag12 提交于 2023-07-12 11:47 . fix build with GCC 12
From 9c1822f59fc41558231b6e67d6feac5a225fcbdb Mon Sep 17 00:00:00 2001
From: David Marchand <david.marchand@redhat.com>
Date: Wed, 18 May 2022 12:16:49 +0200
Subject: [PATCH] net/ena: fix build with GCC 12
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
[ 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>
---
drivers/net/ena/ena_rss.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ena/ena_rss.c b/drivers/net/ena/ena_rss.c
index be4007e3f3..8193eaf6fc 100644
--- a/drivers/net/ena/ena_rss.c
+++ b/drivers/net/ena/ena_rss.c
@@ -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,
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yeqinglong01/dpdk.git
git@gitee.com:yeqinglong01/dpdk.git
yeqinglong01
dpdk
dpdk
master

搜索帮助