提交 8910def1 编写于 作者: W Weiwei 提交者: Xie XiuQi

net: hns3: clean static check detect problems

driver inclusion
category: bugfix
bugzilla: NA
CVE: NA

This patch clean the problems of static check detect problems.
Reported-by: NYongxin Li <liyongxin1@huawei.com>
Signed-off-by: NWeiwei <dengweiwei@huawei.com>
Reviewed-by: NYongxin Li <liyongxin1@huawei.com>
Reviewed-by: Ngaoxun <gaoxun3@huawei.com>
Reviewed-by: NShengzui You <youshengzui@huawei.com>
Reviewed-by: NYunsheng Lin <linyunsheng@huawei.com>
Reviewed-by: NZhaohui Zhong <zhongzhaohui@huawei.com>
Reviewed-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 be8bad40
...@@ -61,7 +61,10 @@ ...@@ -61,7 +61,10 @@
#define HCLGE_OPC_DCQCN_TEMPLATE_CFG 0x7014 #define HCLGE_OPC_DCQCN_TEMPLATE_CFG 0x7014
#define HCLGE_OPC_DCQCN_GET_MSG_CNT 0x7017 #define HCLGE_OPC_DCQCN_GET_MSG_CNT 0x7017
#define HNAE_DRIVER_VERSION "1.8.10.0" #define HNAE_DRIVER_VERSION "1.8.10.1"
#define MAX_MSG_OUT_SIZE (1024U * 2048U)
#define MAX_MSG_IN_SIZE (1024U * 2048U)
struct hclge_chs_param { struct hclge_chs_param {
u8 outer_en; u8 outer_en;
...@@ -110,9 +113,14 @@ static int alloc_buff_in(struct msg_module *nt_msg, u32 in_size, void **buf_in) ...@@ -110,9 +113,14 @@ static int alloc_buff_in(struct msg_module *nt_msg, u32 in_size, void **buf_in)
if (!in_size) if (!in_size)
return 0; return 0;
if (in_size > MAX_MSG_IN_SIZE) {
pr_err("msg in size(%u) more than %u\n",
in_size, MAX_MSG_IN_SIZE);
return -ENOMEM;
}
msg_buf = kzalloc((unsigned long)in_size, GFP_KERNEL); msg_buf = kzalloc((unsigned long)in_size, GFP_KERNEL);
*buf_in = msg_buf; *buf_in = msg_buf;
if (ZERO_OR_NULL_PTR(*buf_in)) { if (ZERO_OR_NULL_PTR(*buf_in)) {
pr_err("alloc buf_in failed\n"); pr_err("alloc buf_in failed\n");
return -ENOMEM; return -ENOMEM;
...@@ -140,8 +148,13 @@ static int alloc_buff_out(u32 out_size, void **buf_out) ...@@ -140,8 +148,13 @@ static int alloc_buff_out(u32 out_size, void **buf_out)
if (!out_size) if (!out_size)
return 0; return 0;
*buf_out = kzalloc((unsigned long)out_size, GFP_KERNEL); if (out_size > MAX_MSG_OUT_SIZE) {
pr_err("msg out size(%u) more than %u\n",
out_size, MAX_MSG_OUT_SIZE);
return -ENOMEM;
}
*buf_out = kzalloc((unsigned long)out_size, GFP_KERNEL);
if (ZERO_OR_NULL_PTR(*buf_out)) { if (ZERO_OR_NULL_PTR(*buf_out)) {
pr_err("alloc buf_out failed\n"); pr_err("alloc buf_out failed\n");
return -ENOMEM; return -ENOMEM;
...@@ -427,10 +440,7 @@ static int get_fw_ver(struct hns3_nic_priv *nic_dev, void *buf_in, u16 in_size, ...@@ -427,10 +440,7 @@ static int get_fw_ver(struct hns3_nic_priv *nic_dev, void *buf_in, u16 in_size,
hdev = vport->back; hdev = vport->back;
out_buf = (struct firmware_ver_param *)buf_out; out_buf = (struct firmware_ver_param *)buf_out;
if (!handle) if (!handle || !hdev)
return -EFAULT;
if (!hdev)
return -EFAULT; return -EFAULT;
if (hns_test_get_commit_id(handle, out_buf->commit_id, if (hns_test_get_commit_id(handle, out_buf->commit_id,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册