From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Ben Boeckel <me@benboeckel.net>
Cc: keyrings@vger.kernel.org, Ben Boeckel <mathstuf@gmail.com>,
linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-security-module@vger.kernel.org,
Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [PATCH 1/1] trusted-keys: match tpm_get_ops on all return paths
Date: Thu, 29 Apr 2021 12:08:34 -0700 [thread overview]
Message-ID: <08179943c02b0952546d01713e24ccba62d1a566.camel@HansenPartnership.com> (raw)
In-Reply-To: <YIsC9mT8XmIi/fbB@erythro>
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
prev parent reply other threads:[~2021-04-29 19:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-29 18:37 [PATCH 0/1] trusted-keys: match tpm_get_ops on all return paths Ben Boeckel
2021-04-29 18:37 ` [PATCH 1/1] " Ben Boeckel
2021-04-29 18:50 ` James Bottomley
2021-04-29 19:03 ` Ben Boeckel
2021-04-29 19:08 ` James Bottomley [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=08179943c02b0952546d01713e24ccba62d1a566.camel@HansenPartnership.com \
--to=james.bottomley@hansenpartnership.com \
--cc=dan.carpenter@oracle.com \
--cc=keyrings@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mathstuf@gmail.com \
--cc=me@benboeckel.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).