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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2f7f51f7-e2a1-6667-3fed-642157437ea2@acm.org>
Date:   Sun, 26 May 2019 08:37:16 -0700
From:   Bart Van Assche <bvanassche@....org>
To:     Hariprasad Kelam <hariprasad.kelam@...il.com>,
        qla2xxx-upstream@...gic.com,
        "James E.J. Bottomley" <jejb@...ux.ibm.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>,
        Alim Akhtar <alim.akhtar@...sung.com>,
        Avri Altman <avri.altman@....com>,
        Pedro Sousa <pedrom.sousa@...opsys.com>,
        Wei Li <liwei213@...wei.com>,
        Geng Jianfeng <gengjianfeng@...ilicon.com>,
        Zang Leigang <zangleigang@...ilicon.com>,
        Stanley Chu <stanley.chu@...iatek.com>,
        Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
        Kangjie Lu <kjlu@....edu>, Arnd Bergmann <arnd@...db.de>,
        linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drivers/scsi: fix warning PTR_ERR_OR_ZERO can be used

On 5/25/19 2:42 AM, Hariprasad Kelam wrote:
> fix below warnig reported by coccicheck
> 
> /drivers/scsi/ufs/ufs-hisi.c:459:1-3: WARNING: PTR_ERR_OR_ZERO can be
> used
> ./drivers/scsi/qla2xxx/tcm_qla2xxx.c:1477:1-3: WARNING: PTR_ERR_OR_ZERO
> can be used
> 
> Signed-off-by: Hariprasad Kelam <hariprasad.kelam@...il.com>
> ---
>  drivers/scsi/qla2xxx/tcm_qla2xxx.c | 4 +---
>  drivers/scsi/ufs/ufs-hisi.c        | 4 +---
>  2 files changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> index ec9f199..4357b34 100644
> --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> @@ -1474,10 +1474,8 @@ static int tcm_qla2xxx_check_initiator_node_acl(
>  				       sizeof(struct qla_tgt_cmd),
>  				       TARGET_PROT_ALL, port_name,
>  				       qlat_sess, tcm_qla2xxx_session_cb);
> -	if (IS_ERR(se_sess))
> -		return PTR_ERR(se_sess);
>  
> -	return 0;
> +	return PTR_ERR_OR_ZERO(se_sess);
>  }
>  
>  static void tcm_qla2xxx_update_sess(struct fc_port *sess, port_id_t s_id,
> diff --git a/drivers/scsi/ufs/ufs-hisi.c b/drivers/scsi/ufs/ufs-hisi.c
> index 7aed0a1..f506044 100644
> --- a/drivers/scsi/ufs/ufs-hisi.c
> +++ b/drivers/scsi/ufs/ufs-hisi.c
> @@ -456,10 +456,8 @@ static int ufs_hisi_get_resource(struct ufs_hisi_host *host)
>  	/* get resource of ufs sys ctrl */
>  	mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
>  	host->ufs_sys_ctrl = devm_ioremap_resource(dev, mem_res);
> -	if (IS_ERR(host->ufs_sys_ctrl))
> -		return PTR_ERR(host->ufs_sys_ctrl);
>  
> -	return 0;
> +	return PTR_ERR_OR_ZERO(host->ufs_sys_ctrl);
>  }

Although I'm not sure this patch improves readability of the source code:

Reviewed-by: Bart Van Assche <bvanassche@....org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ