@@ -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)
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(-)