From: Jarkko Sakkinen <jarkko@kernel.org>
To: Gunnar Kudrjavets <gunnarku@amazon.com>
Cc: peterhuewe@gmx.de, jgg@ziepe.ca, noodles@meta.com,
linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org,
Justinien Bouron <jbouron@amazon.com>
Subject: Re: [PATCH] tpm: Remove dead NULL check in tpm2_flush_space()
Date: Sat, 9 May 2026 14:38:28 +0300 [thread overview]
Message-ID: <af8ctMk1epISg32L@kernel.org> (raw)
In-Reply-To: <af8aRHUDDho2orTW@kernel.org>
On Sat, May 09, 2026 at 02:28:08PM +0300, Jarkko Sakkinen wrote:
> On Mon, Apr 27, 2026 at 04:32:26PM +0000, Gunnar Kudrjavets wrote:
> > The 'space' pointer in tpm2_flush_space() is assigned from
> > &chip->work_space, which is the address of an embedded struct member
> > within struct tpm_chip. This address can never be NULL, making the
> > NULL check dead code. The new code follows the existing pattern
> > established by the other callers in tpm2-space.c which also assign
> > from &chip->work_space without a NULL check. Remove the dead code
> > to avoid confusion.
> >
> > Fixes: e3aaebcbb7c6 ("tpm: Clean up TPM space after command failure")
> > Signed-off-by: Gunnar Kudrjavets <gunnarku@amazon.com>
> > Assisted-by: Kiro:claude-opus-4.6
>
> Just for sake of understanding:
>
> What is "kiro" and is assisted-by the tag supposed to be used here?
>
> > Reviewed-by: Justinien Bouron <jbouron@amazon.com>
> > ---
> > drivers/char/tpm/tpm2-space.c | 3 ---
> > 1 file changed, 3 deletions(-)
> >
> > diff --git a/drivers/char/tpm/tpm2-space.c b/drivers/char/tpm/tpm2-space.c
> > index 60354cd53b5c..1eec72eb8208 100644
> > --- a/drivers/char/tpm/tpm2-space.c
> > +++ b/drivers/char/tpm/tpm2-space.c
> > @@ -169,9 +169,6 @@ void tpm2_flush_space(struct tpm_chip *chip)
> > struct tpm_space *space = &chip->work_space;
> > int i;
> >
> > - if (!space)
> > - return;
> > -
> > for (i = 0; i < ARRAY_SIZE(space->context_tbl); i++)
> > if (space->context_tbl[i] && ~space->context_tbl[i])
> > tpm2_flush_context(chip, space->context_tbl[i]);
> >
> > base-commit: 949692da7211572fac419b2986b6abc0cd1aeb76
> > --
> > 2.47.3
> >
>
> It's all good otherwise, just need clarification as we are learning
> how to deal with these patches :-)
Hold on, I would not remove it: it's an invariant. It's not dead code.
BR, Jarkko
next prev parent reply other threads:[~2026-05-09 11:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260427163238.20230-1-gunnarku@amazon.com>
2026-05-09 11:28 ` [PATCH] tpm: Remove dead NULL check in tpm2_flush_space() Jarkko Sakkinen
2026-05-09 11:38 ` Jarkko Sakkinen [this message]
2026-05-09 22:54 ` Gunnar Kudrjavets
2026-05-10 1:40 ` Jarkko Sakkinen
[not found] <e71c6d95-6c83-4fb4-8cd5-f66067fb68c5@molgen.mpg.de>
[not found] ` <20260427225722.17878-1-gunnarku@amazon.com>
[not found] ` <531b82e9-46c6-485d-95e1-018a3e9fc1b6@molgen.mpg.de>
2026-05-09 12:26 ` Jarkko Sakkinen
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=af8ctMk1epISg32L@kernel.org \
--to=jarkko@kernel.org \
--cc=gunnarku@amazon.com \
--cc=jbouron@amazon.com \
--cc=jgg@ziepe.ca \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=noodles@meta.com \
--cc=peterhuewe@gmx.de \
/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