lkml.org 
[lkml]   [2019]   [Jan]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v8 1/7] tpm: dynamically allocate the allocated_banks array
On Wed, Jan 30, 2019 at 08:52:40AM +0100, Roberto Sassu wrote:
> On 1/29/2019 8:29 PM, Jarkko Sakkinen wrote:
> > On Thu, Jan 24, 2019 at 04:49:04PM +0100, Roberto Sassu wrote:
> > > + chip->allocated_banks = kcalloc(1, sizeof(*chip->allocated_banks),
> > > + GFP_KERNEL);
> > > + if (!chip->allocated_banks) {
> > > + rc = -ENOMEM;
> > > + goto out;
> > > + }
> > > +
> > > + chip->allocated_banks[0] = TPM2_ALG_SHA1;
> > > + chip->nr_allocated_banks = 1;
> >
> > Everything else looks nice in this patch except this.
> >
> > You always branch for TPM 1.2, and it will always have just SHA1. This
> > is unnecessary.
>
> Without this, users of the TPM driver have to call tpm_is_tpm2() first,
> while instead they can look directly at chip->allocated_banks.

I realized this after going through the whole patch set and sleeping
one night :-) You can keep it. I was mistaken here.

/Jarkko

\
 
 \ /
  Last update: 2019-01-30 13:02    [W:0.057 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site