diff options
| author | Yunseong Kim <ysk@kzalloc.com> | 2025-09-03 22:16:43 +0900 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-11-13 15:37:21 -0500 |
| commit | b2e54b1c1672ac077ab539f484becfd7591a1ff5 (patch) | |
| tree | ab50761c4a3bba2379d04597656ff0d4ebd18e30 /drivers/crypto | |
| parent | 364454379f60e1637e4925eeb36a83eaff1c6bfc (diff) | |
| download | linux-b2e54b1c1672ac077ab539f484becfd7591a1ff5.tar.gz linux-b2e54b1c1672ac077ab539f484becfd7591a1ff5.tar.bz2 linux-b2e54b1c1672ac077ab539f484becfd7591a1ff5.zip | |
crypto: ccp - Fix incorrect payload size calculation in psp_poulate_hsti()
[ Upstream commit 2b0dc40ac6ca16ee0c489927f4856cf9cd3874c7 ]
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>> ---
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/crypto')
| -rw-r--r-- | drivers/crypto/ccp/hsti.c | 2 |
1 files changed, 1 insertions, 1 deletions
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) |
