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: <YDaCrwnoZZ/b3VmP@kernel.org>
Date:   Wed, 24 Feb 2021 18:45:35 +0200
From:   Jarkko Sakkinen <jarkko@...nel.org>
To:     Lino Sanfilippo <LinoSanfilippo@....de>
Cc:     peterhuewe@....de, jgg@...pe.ca, stefanb@...ux.vnet.ibm.com,
        James.Bottomley@...senpartnership.com, David.Laight@...lab.com,
        linux-integrity@...r.kernel.org, linux-kernel@...r.kernel.org,
        Lino Sanfilippo <l.sanfilippo@...bus.com>,
        stable@...r.kernel.org
Subject: Re: [PATCH v6] tpm: fix reference counting for struct tpm_chip

On Sun, Feb 21, 2021 at 11:19:28AM +0100, Lino Sanfilippo wrote:
> 
> Hi,
> 
> On 19.02.21 at 10:13, Jarkko Sakkinen wrote:
> 
> >> +	rc = cdev_device_add(&chip->cdevs, &chip->devs);
> >> +	if (rc) {
> >> +		dev_err(&chip->devs,
> >> +			"unable to cdev_device_add() %s, major %d, minor %d, err=%d\n",
> >> +			dev_name(&chip->devs), MAJOR(chip->devs.devt),
> >> +			MINOR(chip->devs.devt), rc);
> >> +		goto out_put_devs;
> >> +	}
> >> +
> >> +	return 0;
> >> +
> >> +out_put_devs:
> >
> > A nit:
> >
> > 1. You have already del_cdev:
> > 2. Here you use a differing convention with out prefix.
> >
> > I'd suggest that you put err_ to both:
> >
> > 1. err_del_cdev
> > 2. err_put_devs
> >
> > It's quite coherent what we have already:
> >
> > linux-tpmdd on  next took 8s
> > ❯ git grep "^err_.*" drivers/char/tpm/ |  wc -l
> > 17
> >
> 
> 
> The label del_cdev is indeed a bit inconsistent with the rest of the code.
> But AFAICS out_put_devs is not:
> 1. all labels in tpm2-space.c start with out_
> 2. there are more hits for out_ across the whole TPM code (i.e. with the same command
> you used above I get 31 hits for _out) than for err_.
> 
> I suggest to rename del_cdev to something like out_del_cdev or maybe out_cdev which
> seems to be even closer to the existing naming scheme for labels.

Generally, I'd prefer the following pattern:

out: /* out for success path if needed */

        return 0;

err_foo:

err_bar:

        return ret;

Existing naming scheme is not something to hang into, and I don't care
to preserve it.

> Regards,
> Lino

/Jarkko
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ