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] [day] [month] [year] [list]
Message-ID: <aGW1wdJQ2oFpGQwq@kernel.org>
Date: Thu, 3 Jul 2025 01:42:09 +0300
From: Jarkko Sakkinen <jarkko@...nel.org>
To: Jason Gunthorpe <jgg@...pe.ca>
Cc: linux-kernel@...r.kernel.org, keyrings@...r.kernel.org,
	Stefan Berger <stefanb@...ux.ibm.com>,
	Jarkko Sakkinen <jarkko.sakkinen@...nsys.com>,
	Peter Huewe <peterhuewe@....de>,
	James Bottomley <James.Bottomley@...senpartnership.com>,
	Mimi Zohar <zohar@...ux.ibm.com>,
	David Howells <dhowells@...hat.com>,
	Paul Moore <paul@...l-moore.com>, James Morris <jmorris@...ei.org>,
	"Serge E. Hallyn" <serge@...lyn.com>,
	"open list:TPM DEVICE DRIVER" <linux-integrity@...r.kernel.org>,
	"open list:SECURITY SUBSYSTEM" <linux-security-module@...r.kernel.org>
Subject: Re: [PATCH v4] tpm: Managed allocations for tpm_buf instances

On Wed, Jul 02, 2025 at 09:57:25AM -0300, Jason Gunthorpe wrote:
> On Tue, Jul 01, 2025 at 05:51:35PM +0300, Jarkko Sakkinen wrote:
> > @@ -32,28 +32,30 @@ struct tpm_readpubek_out {
> >  static ssize_t pubek_show(struct device *dev, struct device_attribute *attr,
> >  			  char *buf)
> >  {
> > -	struct tpm_buf tpm_buf;
> > +	struct tpm_buf *tpm_buf __free(kfree) = NULL;
> >  	struct tpm_readpubek_out *out;
> >  	int i;
> >  	char *str = buf;
> >  	struct tpm_chip *chip = to_tpm_chip(dev);
> >  	char anti_replay[20];
> >  
> > +	tpm_buf = tpm_buf_alloc();
> > +	if (!tpm_buf)
> > +		return -ENOMEM;
> 
> apprently this isn't the style guide, you are supposed to write:
> 
>   	char anti_replay[20];
> 
> 	struct tpm_buf *tpm_buf __free(kfree) =  tpm_buf_alloc();
> 	if (!tpm_buf)
> 		return -ENOMEM;

Sounds fair to me. I'll shift to this direction in the next revision.

> 
> Jason

BR, Jarkko

BR, Jarkko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ