加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0331-net-mvneta-fix-build-with-GCC-12.patch 1.44 KB
一键复制 编辑 原始数据 按行查看 历史
jinag12 提交于 2023-07-12 11:47 . fix build with GCC 12
From 6d030554f1a6a0f2d82bb3371ebb1c5458a49491 Mon Sep 17 00:00:00 2001
From: Amit Prakash Shukla <amitprakashs@marvell.com>
Date: Thu, 1 Sep 2022 14:01:18 +0530
Subject: [PATCH] net/mvneta: fix build with GCC 12
[ upstream commit d7b080f1e72d833d668a66199fe99ccda6c81a36 ]
./drivers/net/mvneta/mvneta_rxtx.c:89:42:
error: 'mbufs' may be used uninitialized [-Werror=maybe-uninitialized]
89 | MVNETA_SET_COOKIE_HIGH_ADDR(mbufs[0]);
| ^
../drivers/net/mvneta/mvneta_rxtx.c:77:26: note: 'mbufs' declared here
77 | struct rte_mbuf *mbufs[MRVL_NETA_BUF_RELEASE_BURST_SIZE_MAX];
| ^~~~~
Fixes: ce7ea764597e ("net/mvneta: support Rx/Tx")
Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>
Acked-by: Liron Himi <lironh@marvell.com>
---
drivers/net/mvneta/mvneta_rxtx.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/mvneta/mvneta_rxtx.c b/drivers/net/mvneta/mvneta_rxtx.c
index 6e4a7896b4..952e982275 100644
--- a/drivers/net/mvneta/mvneta_rxtx.c
+++ b/drivers/net/mvneta/mvneta_rxtx.c
@@ -79,6 +79,10 @@ mvneta_buffs_refill(struct mvneta_priv *priv, struct mvneta_rxq *rxq, u16 *num)
int i, ret;
uint16_t nb_desc = *num;
+ /* To prevent GCC-12 warning. */
+ if (unlikely(nb_desc == 0))
+ return -1;
+
ret = rte_pktmbuf_alloc_bulk(rxq->mp, mbufs, nb_desc);
if (ret) {
MVNETA_LOG(ERR, "Failed to allocate %u mbufs.", nb_desc);
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化