habanalabs: fix return value check in hl_fw_get_sec_attest_data()
PATCH 1/1 habanalabs: fix return value check in hl_fw_get_sec_attest_data()
If hl_cpu_accessible_dma_pool_alloc() fails, we should check 'req_cpu_addr', fix it.
Fixes 0c88760f8f5e ("habanalabs/gaudi2: add secured attestation info uapi")
Signed-off-by Yang Yingliang <[email protected]>
--- drivers/misc/habanalabs/common/firmware_if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/habanalabs/common/firmware_if.c +1 -1
@@ -2983,7 +2983,7 @@ static int hl_fw_get_sec_attest_data(struct hl_device *hdev, u32 packet_id, voidint rc; req_cpu_addr =hl_cpu_accessible_dma_pool_alloc (hdev, size, &req_dma_addr); -if (!data) { +if (!req_cpu_addr) {dev_err (hdev->dev,"Failed to allocate DMA memory for CPU-CP packet %u\n" , packet_id);return -ENOMEM ;
Signature · 1 line
2.25.1
Quoted 24 lines · Yang Yingliang
If
hl_cpu_accessible_dma_pool_alloc()fails, we should check 'req_cpu_addr', fix it.Fixes 0c88760f8f5e ("habanalabs/gaudi2: add secured attestation info uapi")Signed-off-by Yang Yingliang <[email protected]>--- drivers/misc/habanalabs/common/firmware_if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/misc/habanalabs/common/firmware_if.c +1
-2@@ -2983,7 +2983,7 @@ static int hl_fw_get_sec_attest_data(struct hl_device *hdev, u32 packet_id, voidint rc; req_cpu_addr =hl_cpu_accessible_dma_pool_alloc (hdev, size, &req_dma_addr); -if (!data) { +if (!req_cpu_addr) {dev_err (hdev->dev,"Failed to allocate DMA memory for CPU-CP packet %u\n" , packet_id);return -ENOMEM ; --
Quoted 2 lines
2.25.1
Thanks!
Reviewed-by Oded Gabbay <[email protected]>
Applied to -next.
Oded