From: youshengzui youshengzui@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
-----------------------------
This patch is used to fix the Plastic overflow error, and remove redundant code
Signed-off-by: youshengzui youshengzui@huawei.com Reviewed-by: Weiwei Deng dengweiwei@huawei.com Reviewed-by: Zhaohui Zhong zhongzhaohui@huawei.com Reviewed-by: Junxin Chen chenjunxin1@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- .../hisilicon/hns3/hns3_cae/hns3_cae_init.c | 28 ++-------------------- .../hisilicon/hns3/hns3_cae/hns3_cae_promisc.c | 6 ++--- 2 files changed, 4 insertions(+), 30 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_cae/hns3_cae_init.c b/drivers/net/ethernet/hisilicon/hns3/hns3_cae/hns3_cae_init.c index c012c7e..7c084a6 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_cae/hns3_cae_init.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_cae/hns3_cae_init.c @@ -386,37 +386,14 @@ static int hns3_cae_k_open(struct inode *pnode, struct file *pfile) static ssize_t hns3_cae_k_read(struct file *pfile, char __user *ubuf, size_t size, loff_t *ppos) { - pr_info("%s read *ppos:%lld size = %d\n", __func__, *ppos, (int)size); + pr_info("%s read *ppos:%lld size = %lu\n", __func__, *ppos, size); return 0; }
static ssize_t hns3_cae_k_write(struct file *pfile, const char __user *ubuf, size_t size, loff_t *ppos) { - pr_info("%s write *ppos:%lld size = %d\n", __func__, *ppos, (int)size); - return 0; -} - -static int hns3_cae_k_mmap(struct file *filp, struct vm_area_struct *vma) -{ - phys_addr_t offset = (phys_addr_t)vma->vm_pgoff << PAGE_SHIFT; - size_t size = vma->vm_end - vma->vm_start; - int ret; - - vma->vm_flags |= VM_IO; - vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); - - if (offset + (phys_addr_t)size - 1 < offset) - return -EINVAL; - - if (offset >> PAGE_SHIFT != vma->vm_pgoff) - return -EINVAL; - - ret = remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, - size, vma->vm_page_prot); - if (ret) - return -EIO; - + pr_info("%s write *ppos:%lld size = %lu\n", __func__, *ppos, size); return 0; }
@@ -426,7 +403,6 @@ static int hns3_cae_k_mmap(struct file *filp, struct vm_area_struct *vma) .read = hns3_cae_k_read, .write = hns3_cae_k_write, .unlocked_ioctl = hns3_cae_k_unlocked_ioctl, - .mmap = hns3_cae_k_mmap, };
static int if_hns3_cae_exist(void) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_cae/hns3_cae_promisc.c b/drivers/net/ethernet/hisilicon/hns3/hns3_cae/hns3_cae_promisc.c index a337eab..6dd022a 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_cae/hns3_cae_promisc.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_cae/hns3_cae_promisc.c @@ -26,10 +26,9 @@ int hns3_read_promisc_mode_cfg(const struct hns3_nic_priv *nic_dev, vport = hns3_cae_get_vport(nic_dev->ae_handle); hdev = vport->back; req = (struct hclge_promisc_cfg_cmd *)desc.data; - req->vf_id = vport->vport_id; hns3_cae_cmd_setup_basic_desc(&desc, HCLGE_OPC_CFG_PROMISC_MODE, true); + req->vf_id = vport->vport_id; ret = hns3_cae_cmd_send(hdev, &desc, 1); - req = (struct hclge_promisc_cfg_cmd *)desc.data; if (ret) { dev_err(&hdev->pdev->dev, "Get promisc mode fail, ret is %d.\n", ret); @@ -62,11 +61,10 @@ int hns3_set_promisc_mode_cfg(const struct hns3_nic_priv *nic_dev, vport = hns3_cae_get_vport(nic_dev->ae_handle); hdev = vport->back; req = (struct hclge_promisc_cfg_cmd *)desc.data; - req->vf_id = vport->vport_id; mode_param = (struct promisc_mode_param *)buf_in; hns3_cae_cmd_setup_basic_desc(&desc, HCLGE_OPC_CFG_PROMISC_MODE, true); + req->vf_id = vport->vport_id; ret = hns3_cae_cmd_send(hdev, &desc, 1); - req = (struct hclge_promisc_cfg_cmd *)desc.data; if (ret) { dev_err(&hdev->pdev->dev, "Get promisc mode fail, ret is %d.\n", ret);