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: <20210617093219.GE1861@kadam>
Date:   Thu, 17 Jun 2021 12:32:19 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Yang Yingliang <yangyingliang@...wei.com>
Cc:     linux-kernel@...r.kernel.org, linux-staging@...ts.linux.dev,
        linux-media@...r.kernel.org, mchehab@...nel.org,
        sakari.ailus@...ux.intel.com
Subject: Re: [PATCH -next] media: staging: media: atomisp: pci: fix error
 return code in atomisp_pci_probe()

On Thu, Jun 17, 2021 at 03:23:29PM +0800, Yang Yingliang wrote:
> If init_atomisp_wdts() fails, atomisp_pci_probe() need return
> error code.
> 
> Reported-by: Hulk Robot <hulkci@...wei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
> ---
>  drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
> index 948769ca6539..5de878fe798b 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
> @@ -1763,7 +1763,8 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
>  	if (err < 0)
>  		goto register_entities_fail;
>  	/* init atomisp wdts */
> -	if (init_atomisp_wdts(isp) != 0)
> +	err = init_atomisp_wdts(isp);
> +	if (err != 0)

Change this to: if (err).

Only use != 0 when you are talking about numbers or for strcmp().

	if (num != 0) // it's fine because we are talking about zero as
		      // number zero.

	if (len == 0) // fine, length is measured in numbers.

	if (err != 0) // In this case, error is not a number but either
		      // an error code or success.  It's not like -3 is
		      // worse than -2 or anything like that.  It's not
		      // a count or a measurement.

For (strcmp(a, b) != 0), the != means "a != b".

regards,
dan carpenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ