1 Star 0 Fork 124

zhouli57/src-qemu

forked from src-openEuler/qemu 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
net-l2tpv3-Remove-redundant-check-in-net_init_l2tpv3.patch 1.31 KB
一键复制 编辑 原始数据 按行查看 历史
From cb6048ace290e770b0ec1a6011209192541d3e8a Mon Sep 17 00:00:00 2001
From: AlexChen <alex.chen@huawei.com>
Date: Fri, 30 Oct 2020 10:46:55 +0800
Subject: [PATCH] net/l2tpv3: Remove redundant check in net_init_l2tpv3()
The result has been checked to be NULL before, it cannot be NULL here,
so the check is redundant. Remove it.
Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: AlexChen <alex.chen@huawei.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
(cherry-picked from commit d949fe64b0)
---
net/l2tpv3.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/net/l2tpv3.c b/net/l2tpv3.c
index 55fea17c0f..e4d4218db6 100644
--- a/net/l2tpv3.c
+++ b/net/l2tpv3.c
@@ -655,9 +655,8 @@ int net_init_l2tpv3(const Netdev *netdev,
error_setg(errp, "could not bind socket err=%i", errno);
goto outerr;
}
- if (result) {
- freeaddrinfo(result);
- }
+
+ freeaddrinfo(result);
memset(&hints, 0, sizeof(hints));
@@ -686,9 +685,7 @@ int net_init_l2tpv3(const Netdev *netdev,
memcpy(s->dgram_dst, result->ai_addr, result->ai_addrlen);
s->dst_size = result->ai_addrlen;
- if (result) {
- freeaddrinfo(result);
- }
+ freeaddrinfo(result);
if (l2tpv3->has_counter && l2tpv3->counter) {
s->has_counter = true;
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhouli57/src-qemu.git
git@gitee.com:zhouli57/src-qemu.git
zhouli57
src-qemu
src-qemu
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385