Re: [PATCH RESEND 2/3] tpm: replace dynamically allocated bios_dir with a static array
From: Jarkko Sakkinen
Date: Tue Oct 11 2016 - 14:10:12 EST
On Tue, Oct 11, 2016 at 10:53:55AM -0600, Jason Gunthorpe wrote:
> On Tue, Oct 11, 2016 at 02:23:15PM +0300, Jarkko Sakkinen wrote:
> > > >+ chip->bios_dir[cnt] =
> > > > securityfs_create_file("ascii_bios_measurements",
> > > >- S_IRUSR | S_IRGRP, tpm_dir,
> > > >+ S_IRUSR | S_IRGRP, chip->bios_dir,
> > > > (void *)&tpm_ascii_b_measurments_seqops,
> > > > &tpm_bios_measurements_ops);
> > > >+ if (is_bad(chip->bios_dir[cnt]))
> > > >+ goto err;
> > > >+err:
> > > >+ chip->bios_dir[cnt] = NULL;
> > >
> > > The updated patch looks fine.
> > > Just, I am not sure if NULL assignment is needed.
> > It's not needed.
> It is required to switch an ERR_PTR to NULL, see is_bad()
> The original version that used a counter in chip did not need it.
Oops, sorry. I added it back. Thanks for pointing this out.