All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko@kernel.org>
To: Dinghao Liu <dinghao.liu@zju.edu.cn>
Cc: kjlu@umn.edu, Peter Huewe <peterhuewe@gmx.de>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tpm: Add missing check in tpm_inf_recv
Date: Mon, 1 Mar 2021 11:48:39 +0200	[thread overview]
Message-ID: <YDy4d5qO8MrNwImx@kernel.org> (raw)
In-Reply-To: <20210228093230.5676-1-dinghao.liu@zju.edu.cn>

On Sun, Feb 28, 2021 at 05:32:30PM +0800, Dinghao Liu wrote:
> The use of wait() in tpm_inf_recv() is almost the same. It's odd that
> we only check the return value and terminate execution flow of one call.
> 
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>

Is the unchecked return value of wait() the problem? I don't see the
function even mentioned in the description.

/Jarkko

> ---
>  drivers/char/tpm/tpm_infineon.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/char/tpm/tpm_infineon.c b/drivers/char/tpm/tpm_infineon.c
> index 9c924a1440a9..abe00f45aa45 100644
> --- a/drivers/char/tpm/tpm_infineon.c
> +++ b/drivers/char/tpm/tpm_infineon.c
> @@ -263,7 +263,9 @@ static int tpm_inf_recv(struct tpm_chip *chip, u8 * buf, size_t count)
>  		size = ((buf[2] << 8) | buf[3]);
>  
>  		for (i = 0; i < size; i++) {
> -			wait(chip, STAT_RDA);
> +			ret = wait(chip, STAT_RDA);
> +			if (ret)
> +				return -EIO;
>  			buf[i] = tpm_data_in(RDFIFO);
>  		}
>  
> -- 
> 2.17.1
> 
> 

  reply	other threads:[~2021-03-01  9:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-28  9:32 [PATCH] tpm: Add missing check in tpm_inf_recv Dinghao Liu
2021-03-01  9:48 ` Jarkko Sakkinen [this message]
2021-03-01 11:30   ` dinghao.liu

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=YDy4d5qO8MrNwImx@kernel.org \
    --to=jarkko@kernel.org \
    --cc=dinghao.liu@zju.edu.cn \
    --cc=jgg@ziepe.ca \
    --cc=kjlu@umn.edu \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.