lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6d37fe4e-91ed-4b65-b729-5de69e8655a2@linux.dev>
Date: Sun, 23 Mar 2025 08:53:50 +0100
From: Zhu Yanjun <yanjun.zhu@...ux.dev>
To: Yue Haibing <yuehaibing@...wei.com>, benve@...co.com, neescoba@...co.com,
 jgg@...pe.ca, leon@...nel.org, liyuyu6@...wei.com, umalhi@...co.com,
 roland@...estorage.com
Cc: linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH -next] RDMA/usnic: Fix passing zero to PTR_ERR in
 usnic_ib_pci_probe()

在 2025/3/23 4:34, Yue Haibing 写道:
> drivers/infiniband/hw/usnic/usnic_ib_main.c:590
>   usnic_ib_pci_probe() warn: passing zero to 'PTR_ERR'
> 
> Use err code in usnic_err() to fix this.
> 
> Fixes: e3cf00d0a87f ("IB/usnic: Add Cisco VIC low-level hardware driver")
> Signed-off-by: Yue Haibing <yuehaibing@...wei.com>
> ---
>   drivers/infiniband/hw/usnic/usnic_ib_main.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/usnic/usnic_ib_main.c b/drivers/infiniband/hw/usnic/usnic_ib_main.c
> index 4ddcd5860e0f..e40370f9ff25 100644
> --- a/drivers/infiniband/hw/usnic/usnic_ib_main.c
> +++ b/drivers/infiniband/hw/usnic/usnic_ib_main.c
> @@ -587,9 +587,9 @@ static int usnic_ib_pci_probe(struct pci_dev *pdev,
>   
>   	pf = usnic_ib_discover_pf(vf->vnic);
>   	if (IS_ERR_OR_NULL(pf)) {
> -		usnic_err("Failed to discover pf of vnic %s with err%ld\n",
> -				pci_name(pdev), PTR_ERR(pf));
>   		err = pf ? PTR_ERR(pf) : -EFAULT;

When pf is NULL, PTR_ERR(pf) will warn "passing zero to PTR_ERR". Thus, 
if pf is NULL, the err will be set to -EFAULT.

But from the current implementation of "static struct usnic_ib_dev 
*usnic_ib_discover_pf(struct usnic_vnic *vnic)", it seems that pf can 
not be set to NULL.

But this commit can prevent this warning when the implementation of 
usnic_ib_discover_pf will be changed in the future.

Reviewed-by: Zhu Yanjun <yanjun.zhu@...ux.dev>

Zhu Yanjun

> +		usnic_err("Failed to discover pf of vnic %s with err%d\n",
> +				pci_name(pdev), err);
>   		goto out_clean_vnic;
>   	}
>   


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ