Skip to content

Commit 2b0dc40

Browse files
yskzallocherbertx
authored andcommitted
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 <ysk@kzalloc.com> Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>> --- Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent f5d6431 commit 2b0dc40

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/crypto/ccp/hsti.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static int psp_populate_hsti(struct psp_device *psp)
8888
if (!req)
8989
return -ENOMEM;
9090

91-
req->header.payload_size = sizeof(req);
91+
req->header.payload_size = sizeof(*req);
9292

9393
ret = psp_send_platform_access_msg(PSP_CMD_HSTI_QUERY, (struct psp_request *)req);
9494
if (ret)

0 commit comments

Comments
 (0)