From: Mario Limonciello <superm1@kernel.org>
To: Yunseong Kim <ysk@kzalloc.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Tom Lendacky <thomas.lendacky@amd.com>,
John Allen <john.allen@amd.com>,
"David S. Miller" <davem@davemloft.net>
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] crypto: ccp: Fix incorrect payload size calculation in psp_poulate_hsti()
Date: Wed, 3 Sep 2025 09:54:13 -0500 [thread overview]
Message-ID: <3603d3a2-4527-4ac4-82aa-7533f33e92db@kernel.org> (raw)
In-Reply-To: <20250903131642.16798-2-ysk@kzalloc.com>
On 9/3/25 8:16 AM, Yunseong Kim wrote:
> payload_size field of the request header is incorrectly calculated using
> sizeof(req). Since 'req' is a pointer (struct hsti_request *), sizeof(req)
> returns the size of the pointer itself (e.g., 8 bytes on a 64-bit system),
> rather than the size of the structure it points to. This leads to an
> incorrect payload size being sent to the Platform Security Processor (PSP),
> potentially causing the HSTI query command to fail.
>
> Fix this by using sizeof(*req) to correctly calculate the size of the
> struct hsti_request.
>
> Signed-off-by: Yunseong Kim <ysk@kzalloc.com>
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>> ---
> drivers/crypto/ccp/hsti.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/crypto/ccp/hsti.c b/drivers/crypto/ccp/hsti.c
> index 1b39a4fb55c0..0e6b73b55dbf 100644
> --- a/drivers/crypto/ccp/hsti.c
> +++ b/drivers/crypto/ccp/hsti.c
> @@ -88,7 +88,7 @@ static int psp_poulate_hsti(struct psp_device *psp)
> if (!req)
> return -ENOMEM;
>
> - req->header.payload_size = sizeof(req);
> + req->header.payload_size = sizeof(*req);
>
> ret = psp_send_platform_access_msg(PSP_CMD_HSTI_QUERY, (struct psp_request *)req);
> if (ret)
next prev parent reply other threads:[~2025-09-03 14:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-03 13:16 Yunseong Kim
2025-09-03 14:54 ` Mario Limonciello [this message]
2025-09-13 4:27 ` Herbert Xu
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=3603d3a2-4527-4ac4-82aa-7533f33e92db@kernel.org \
--to=superm1@kernel.org \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=john.allen@amd.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=thomas.lendacky@amd.com \
--cc=ysk@kzalloc.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®