1 Star 0 Fork 52

tcc@hello/rdma-core

forked from src-openEuler/rdma-core 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0072-libhns-Add-input-parameter-check-for-hnsdv_query_dev.patch 1.38 KB
一键复制 编辑 原始数据 按行查看 历史
zzry 提交于 2023-11-27 17:16 +08:00 . Corrects several minor issues found in review
From 884663cd803e3781aec9c45f7fc0145b6a2b4539 Mon Sep 17 00:00:00 2001
From: Luoyouming <luoyouming@huawei.com>
Date: Mon, 27 Nov 2023 16:39:49 +0800
Subject: [PATCH 72/75] libhns: Add input parameter check for
hnsdv_query_device()
driver inclusion
category: cleanup
bugzilla: https://gitee.com/src-openeuler/rdma-core/issues/I8J2W9?from=project-issue
--------------------------------------------------------------------------
Add null pointer check for pointer parameter.
Signed-off-by: Luoyouming <luoyouming@huawei.com>
---
providers/hns/hns_roce_u_verbs.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/providers/hns/hns_roce_u_verbs.c b/providers/hns/hns_roce_u_verbs.c
index c906632..e597e93 100644
--- a/providers/hns/hns_roce_u_verbs.c
+++ b/providers/hns/hns_roce_u_verbs.c
@@ -126,15 +126,16 @@ int hnsdv_query_device(struct ibv_context *context,
struct hnsdv_context *attrs_out)
{
struct hns_roce_context *ctx = context ? to_hr_ctx(context) : NULL;
- struct hns_roce_device *hr_dev = to_hr_dev(context->device);
+ struct hns_roce_device *hr_dev;
if (!ctx || !attrs_out)
return EINVAL;
- if (!hr_dev) {
+ if (!context->device && !is_hns_dev(context->device)) {
verbs_err(verbs_get_ctx(context), "not a HNS RoCE device!\n");
return EOPNOTSUPP;
}
+ hr_dev = to_hr_dev(context->device);
memset(attrs_out, 0, sizeof(*attrs_out));
--
2.25.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hellotcc/rdma-core.git
git@gitee.com:hellotcc/rdma-core.git
hellotcc
rdma-core
rdma-core
master

搜索帮助