linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko@kernel.org>
To: Zhihao Cheng <chengzhihao1@huawei.com>
Cc: peterhuewe@gmx.de, linux-integrity@vger.kernel.org,
	linux-kernel@vger.kernel.org, yi.zhang@huawei.com,
	yukuai3@huawei.com
Subject: Re: [PATCH v2] char: tpm: fix error return code in tpm_cr50_i2c_tis_recv()
Date: Fri, 9 Apr 2021 08:50:52 +0300	[thread overview]
Message-ID: <YG/rPLtWwhFTgqor@kernel.org> (raw)
In-Reply-To: <20210409011201.1589080-1-chengzhihao1@huawei.com>

On Fri, Apr 09, 2021 at 09:12:01AM +0800, Zhihao Cheng wrote:
> Fix to return a negative error code from the error handling
> case instead of 0, as done elsewhere in this function.
> 
> Fixes: 3a253caaad11 ("char: tpm: add i2c driver for cr50")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>

Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

> ---
>  drivers/char/tpm/tpm_tis_i2c_cr50.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/char/tpm/tpm_tis_i2c_cr50.c b/drivers/char/tpm/tpm_tis_i2c_cr50.c
> index ec9a65e7887d..f19c227d20f4 100644
> --- a/drivers/char/tpm/tpm_tis_i2c_cr50.c
> +++ b/drivers/char/tpm/tpm_tis_i2c_cr50.c
> @@ -483,6 +483,7 @@ static int tpm_cr50_i2c_tis_recv(struct tpm_chip *chip, u8 *buf, size_t buf_len)
>  	expected = be32_to_cpup((__be32 *)(buf + 2));
>  	if (expected > buf_len) {
>  		dev_err(&chip->dev, "Buffer too small to receive i2c data\n");
> +		rc = -E2BIG;
>  		goto out_err;
>  	}
>  
> -- 
> 2.25.4
> 
> 

/Jarkko

      reply	other threads:[~2021-04-09  5:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-09  1:12 [PATCH v2] char: tpm: fix error return code in tpm_cr50_i2c_tis_recv() Zhihao Cheng
2021-04-09  5:50 ` Jarkko Sakkinen [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=YG/rPLtWwhFTgqor@kernel.org \
    --to=jarkko@kernel.org \
    --cc=chengzhihao1@huawei.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    --cc=yi.zhang@huawei.com \
    --cc=yukuai3@huawei.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).