[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <08179943c02b0952546d01713e24ccba62d1a566.camel@HansenPartnership.com>
Date: Thu, 29 Apr 2021 12:08:34 -0700
From: James Bottomley <James.Bottomley@...senPartnership.com>
To: Ben Boeckel <me@...boeckel.net>
Cc: keyrings@...r.kernel.org, Ben Boeckel <mathstuf@...il.com>,
linux-integrity@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-security-module@...r.kernel.org,
Dan Carpenter <dan.carpenter@...cle.com>
Subject: Re: [PATCH 1/1] trusted-keys: match tpm_get_ops on all return paths
On Thu, 2021-04-29 at 15:03 -0400, Ben Boeckel wrote:
> On Thu, Apr 29, 2021 at 11:50:50 -0700, James Bottomley wrote:
> > Actually, I think this is a better fix to avoid multiple put and
> > returns.
> >
> > James
> >
> > ---
> >
> > diff --git a/security/keys/trusted-keys/trusted_tpm2.c
> > b/security/keys/trusted-keys/trusted_tpm2.c
> > index d225ad140960..cbf2a932577b 100644
> > --- a/security/keys/trusted-keys/trusted_tpm2.c
> > +++ b/security/keys/trusted-keys/trusted_tpm2.c
> > @@ -336,9 +336,9 @@ int tpm2_seal_trusted(struct tpm_chip *chip,
> > rc = -EPERM;
> > }
> > if (blob_len < 0)
> > - return blob_len;
> > -
> > - payload->blob_len = blob_len;
> > + rc = blob_len;
> > + else
> > + payload->blob_len = blob_len;
> >
> > tpm_put_ops(chip);
> > return rc;
>
> Ah, that does look better. I had first added a new label, but that
> didn't seem like an improvement in readability. I grabbed this
> pattern from an early return earlier in the function. But given that
> this is the end (and appears to be unlikely to have more logic
> inserted in the future), this seems more reasonable to me as well. Do
> you want me to respin or just let it up to you at this point?
Can you respin? ... I'm a bit lossy at the moment due to pressure of
work.
Thanks,
James
Powered by blists - more mailing lists