1 Star 0 Fork 76

叶青龙/dpdk

forked from src-openEuler/dpdk 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0319-net-enetfec-fix-build-with-GCC-12.patch 2.35 KB
一键复制 编辑 原始数据 按行查看 历史
jinag12 提交于 2023-07-12 11:47 . fix build with GCC 12
From ac8e3a7546ecf4c0b0a753c1efd8327e3a3e96f1 Mon Sep 17 00:00:00 2001
From: David Marchand <[email protected]>
Date: Wed, 18 May 2022 12:16:50 +0200
Subject: [PATCH] net/enetfec: fix build with GCC 12
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
[ upstream commit 7c3c0d0f290cfc03dc0e75013af8035b450ee114 ]
GCC 12 raises the following warning:
../drivers/net/enetfec/enet_ethdev.c: In function
‘enetfec_rx_queue_setup’:
../drivers/net/enetfec/enet_ethdev.c:473:9: error: array
subscript 1 is
above array bounds of ‘uint32_t[1]’ {aka ‘unsigned int[1]’}
[-Werror=array-bounds]
473 | rte_write32(rte_cpu_to_le_32(fep->bd_addr_p_r[queue_idx]),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
474 | (uint8_t *)fep->hw_baseaddr_v + ENETFEC_RD_START(queue_idx));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/net/enetfec/enet_ethdev.c:9:
../drivers/net/enetfec/enet_ethdev.h:113:33: note: while referencing
‘bd_addr_p_r’
113 | uint32_t bd_addr_p_r[ENETFEC_MAX_Q];
| ^~~~~~~~~~~
This driver properly announces that it only supports 1 rxq.
Silence this warning by adding an explicit check on the queue id.
Signed-off-by: David Marchand <[email protected]>
Acked-by: Stephen Hemminger <[email protected]>
Acked-by: Sachin Saxena <[email protected]>
---
drivers/net/enetfec/enet_ethdev.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/net/enetfec/enet_ethdev.c b/drivers/net/enetfec/enet_ethdev.c
index 714f8ac7ec..c938e58204 100644
--- a/drivers/net/enetfec/enet_ethdev.c
+++ b/drivers/net/enetfec/enet_ethdev.c
@@ -2,9 +2,12 @@
* Copyright 2020-2021 NXP
*/
+#include <inttypes.h>
+
#include <ethdev_vdev.h>
#include <ethdev_driver.h>
#include <rte_io.h>
+
#include "enet_pmd_logs.h"
#include "enet_ethdev.h"
#include "enet_regs.h"
@@ -454,6 +457,12 @@ enetfec_rx_queue_setup(struct rte_eth_dev *dev,
return -EINVAL;
}
+ if (queue_idx >= ENETFEC_MAX_Q) {
+ ENETFEC_PMD_ERR("Invalid queue id %" PRIu16 ", max %d\n",
+ queue_idx, ENETFEC_MAX_Q);
+ return -EINVAL;
+ }
+
/* allocate receive queue */
rxq = rte_zmalloc(NULL, sizeof(*rxq), RTE_CACHE_LINE_SIZE);
if (rxq == NULL) {
--
2.23.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yeqinglong01/dpdk.git
[email protected]:yeqinglong01/dpdk.git
yeqinglong01
dpdk
dpdk
master

搜索帮助