Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 1 | From b81214dea7056c3877aa9eb775557dc4702660ec Mon Sep 17 00:00:00 2001 |
| 2 | From: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com> |
| 3 | Date: Sun, 12 Dec 2021 17:58:08 +0000 |
| 4 | Subject: [PATCH 21/27] Update comm_buf when EFI_BUFFER_TOO_SMALL |
| 5 | |
| 6 | When the received buffer is larger than the comm buffer, |
| 7 | the contents of the shared buffer which can fit in the |
| 8 | comm buffer should be read before returning. |
| 9 | |
| 10 | Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com> |
| 11 | Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> |
| 12 | --- |
| 13 | lib/efi_loader/efi_variable_tee.c | 1 + |
| 14 | 1 file changed, 1 insertion(+) |
| 15 | |
| 16 | diff --git a/lib/efi_loader/efi_variable_tee.c b/lib/efi_loader/efi_variable_tee.c |
| 17 | index 38655a9dbb7c..67743d1f8fce 100644 |
| 18 | --- a/lib/efi_loader/efi_variable_tee.c |
| 19 | +++ b/lib/efi_loader/efi_variable_tee.c |
| 20 | @@ -357,6 +357,7 @@ static efi_status_t __efi_runtime ffa_mm_communicate(void *comm_buf, ulong comm_ |
| 21 | sizeof(size_t); |
| 22 | |
| 23 | if (rx_data_size > comm_buf_size) { |
| 24 | + efi_memcpy_runtime(comm_buf, virt_shared_buf, comm_buf_size); |
| 25 | unmap_sysmem(virt_shared_buf); |
| 26 | return EFI_BUFFER_TOO_SMALL; |
| 27 | } |
| 28 | -- |
| 29 | 2.30.2 |
| 30 | |