mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tom Lendacky <thomas.lendacky@amd.com>
To: Mario Limonciello <mario.limonciello@amd.com>,
	Herbert Xu <herbert@gondor.apana.org.au>
Cc: John Allen <john.allen@amd.com>,
	"open list:AMD CRYPTOGRAPHIC COPROCESSOR (CCP) DRIVER - DB..."
	<linux-crypto@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	Tim Van Patten <timvp@google.com>
Subject: Re: [PATCH 1/2] crypto: ccp: Avoid discarding errors in psp_send_platform_access_msg()
Date: Fri, 9 Feb 2024 13:05:51 -0600	[thread overview]
Message-ID: <a9b139fe-832d-889b-3d1a-2122e9c26a11@amd.com> (raw)
In-Reply-To: <20240207215439.95871-1-mario.limonciello@amd.com>

On 2/7/24 15:54, Mario Limonciello wrote:
> When the PSP_CMDRESP_STS field has an error set, the details of the
> error are in `req->header->status`, and the caller will want to look
> at them. But if there is no error set then caller may want to check
> `req->header->status` separately.
> 
> Stop discarding these errors.

This needs a more thorough commit message. It took me a bit to understand 
that the value in the request header could be set to something specific to 
the request even though the command response status comes back as zero.

Which also indicates that the code below should have a nice comment about 
why you only set req->header.status when PSP_CMDRESP_STS is non-zero (in 
other words the existing comment needs to be re-worded).

Thanks,
Tom

> 
> Reported-by: Tim Van Patten <timvp@google.com>
> Fixes: 7ccc4f4e2e50 ("crypto: ccp - Add support for an interface for platform features")
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
>   drivers/crypto/ccp/platform-access.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/crypto/ccp/platform-access.c b/drivers/crypto/ccp/platform-access.c
> index 94367bc49e35..792ae8d5b11a 100644
> --- a/drivers/crypto/ccp/platform-access.c
> +++ b/drivers/crypto/ccp/platform-access.c
> @@ -120,7 +120,8 @@ int psp_send_platform_access_msg(enum psp_platform_access_msg msg,
>   
>   	/* Store the status in request header for caller to investigate */
>   	cmd_reg = ioread32(cmd);
> -	req->header.status = FIELD_GET(PSP_CMDRESP_STS, cmd_reg);
> +	if (FIELD_GET(PSP_CMDRESP_STS, cmd_reg))
> +		req->header.status = FIELD_GET(PSP_CMDRESP_STS, cmd_reg);
>   	if (req->header.status) {
>   		ret = -EIO;
>   		goto unlock;

      parent reply	other threads:[~2024-02-09 19:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-07 21:54 Mario Limonciello
2024-02-07 21:54 ` [PATCH 2/2] crypto: ccp: Update return values for some unit tests Mario Limonciello
2024-02-08 17:24 ` [PATCH 1/2] crypto: ccp: Avoid discarding errors in psp_send_platform_access_msg() Tim Van Patten
2024-02-09 19:05 ` Tom Lendacky [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=a9b139fe-832d-889b-3d1a-2122e9c26a11@amd.com \
    --to=thomas.lendacky@amd.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=john.allen@amd.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=timvp@google.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

all inboxes | Powered by JetHome®