From: Yunseong Kim Date: Wed, 3 Sep 2025 13:16:43 +0000 (+0900) Subject: crypto: ccp - Fix incorrect payload size calculation in psp_poulate_hsti() X-Git-Tag: v6.18-rc1~84^2~25 X-Git-Url: https://gentwo.org/gitweb/?a=commitdiff_plain;h=2b0dc40ac6ca16ee0c489927f4856cf9cd3874c7;p=linux%2F.git crypto: ccp - Fix incorrect payload size calculation in psp_poulate_hsti() 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 Reviewed-by: Mario Limonciello (AMD) > --- Signed-off-by: Herbert Xu --- diff --git a/drivers/crypto/ccp/hsti.c b/drivers/crypto/ccp/hsti.c index 36f6534fbe08..c29c6a9c0f3f 100644 --- a/drivers/crypto/ccp/hsti.c +++ b/drivers/crypto/ccp/hsti.c @@ -88,7 +88,7 @@ static int psp_populate_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)