summaryrefslogtreecommitdiff
path: root/drivers/crypto
diff options
context:
space:
mode:
authorYunseong Kim <ysk@kzalloc.com>2025-09-03 22:16:43 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-11-13 15:34:23 -0500
commitdcfd2557325ac4b8e8c4bd35bfef884c7e41110b (patch)
treee3ffa3af220aebf7af67e46c9ed363d2d7fe211b /drivers/crypto
parentc65a83bcc90fbb3c9b4fba4e7cf37b1eb39db180 (diff)
downloadlinux-dcfd2557325ac4b8e8c4bd35bfef884c7e41110b.tar.gz
linux-dcfd2557325ac4b8e8c4bd35bfef884c7e41110b.tar.bz2
linux-dcfd2557325ac4b8e8c4bd35bfef884c7e41110b.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.c2
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)