From: Jarkko Sakkinen <jarkko@kernel.org>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: linux-integrity@vger.kernel.org, keyrings@vger.kernel.org,
Andreas.Fuchs@infineon.com, James Prestwood <prestwoj@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
Eric Biggers <ebiggers@kernel.org>,
James Bottomley <James.Bottomley@hansenpartnership.com>,
linux-crypto@vger.kernel.org,
Stefan Berger <stefanb@linux.ibm.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jarkko Sakkinen <jarkko@kernel.org>,
Peter Huewe <peterhuewe@gmx.de>, Jason Gunthorpe <jgg@ziepe.ca>,
James Bottomley <James.Bottomley@HansenPartnership.com>,
Mimi Zohar <zohar@linux.ibm.com>,
David Howells <dhowells@redhat.com>,
Paul Moore <paul@paul-moore.com>,
James Morris <jmorris@namei.org>,
"Serge E. Hallyn" <serge@hallyn.com>,
Ard Biesheuvel <ardb@kernel.org>,
linux-kernel@vger.kernel.org,
linux-security-module@vger.kernel.org
Subject: [PATCH] tpm: Remove illict WARN's from tpm2-sessions.c
Date: Wed, 29 May 2024 18:38:34 +0300 [thread overview]
Message-ID: <20240529153835.14994-1-jarkko@kernel.org> (raw)
Sprinkling all over the place is just plain wrong so drop all of them
before the TPM bus encryption feature hits a release.
Link: https://lore.kernel.org/lkml/20240414170850.148122-1-elder@linaro.org/
Fixes: 1085b8276bb4 ("tpm: Add the rest of the session HMAC API")
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
---
I have had to literally fight for so many other cosmetic things such as
https://lore.kernel.org/linux-integrity/20240528095438.1857-1-jarkko@kernel.org/T/#u
so that I must have missed this.
If I contribute to any subsystem, I just plain do all that is asked,
no questions asked. Only reason I left a review unaddressed is when
I see some intersection with the architecture.
And lastly, not introducing new WARN's should be dead obvious, unless
per-WARN explicitly reasoned in the commit message near to the level
that it could be proven at court. Unless this care, I will simply not
review patch with something like this embedded.
---
drivers/char/tpm/tpm2-sessions.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/char/tpm/tpm2-sessions.c b/drivers/char/tpm/tpm2-sessions.c
index 907ac9956a78..371cf28a2b6a 100644
--- a/drivers/char/tpm/tpm2-sessions.c
+++ b/drivers/char/tpm/tpm2-sessions.c
@@ -394,7 +394,7 @@ void tpm_buf_append_hmac_session(struct tpm_chip *chip, struct tpm_buf *buf,
/* we're not the first session */
len = get_unaligned_be32(&buf->data[auth->session]);
if (4 + len + auth->session != tpm_buf_length(buf)) {
- WARN(1, "session length mismatch, cannot append");
+ pr_warn("tpm: session length mismatch, cannot append");
return;
}
@@ -644,8 +644,10 @@ void tpm_buf_append_name(struct tpm_chip *chip, struct tpm_buf *buf,
dev_err(&chip->dev, "TPM: too many handles\n");
return;
}
- WARN(auth->session != tpm_buf_length(buf),
- "name added in wrong place\n");
+ if (auth->session != tpm_buf_length(buf)) {
+ pr_warn("tpm: name added in wrong place\n");
+ return;
+ }
tpm_buf_append_u32(buf, handle);
auth->session += 4;
@@ -706,8 +708,8 @@ int tpm_buf_check_hmac_response(struct tpm_chip *chip, struct tpm_buf *buf,
int parm_len, len, i, handles;
if (auth->session >= TPM_HEADER_SIZE) {
- WARN(1, "tpm session not filled correctly\n");
- goto out;
+ pr_warn("tpm session not filled correctly\n");
+ return;
}
if (rc != 0)
--
2.45.1
reply other threads:[~2024-05-29 15:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240529153835.14994-1-jarkko@kernel.org \
--to=jarkko@kernel.org \
--cc=Andreas.Fuchs@infineon.com \
--cc=James.Bottomley@hansenpartnership.com \
--cc=ardb@kernel.org \
--cc=dhowells@redhat.com \
--cc=dwmw2@infradead.org \
--cc=ebiggers@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=herbert@gondor.apana.org.au \
--cc=jgg@ziepe.ca \
--cc=jmorris@namei.org \
--cc=keyrings@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=paul@paul-moore.com \
--cc=peterhuewe@gmx.de \
--cc=prestwoj@gmail.com \
--cc=serge@hallyn.com \
--cc=stefanb@linux.ibm.com \
--cc=zohar@linux.ibm.com \
/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).