diff mbox

[2/4] efi_runtime: add datasize return when getting the EFI_BUFFER_TOO_SMALL

Message ID 1470649228-15522-2-git-send-email-ivan.hu@canonical.com
State Accepted
Headers show

Commit Message

Ivan Hu Aug. 8, 2016, 9:40 a.m. UTC
Data size is required to return when getting the EFI_BUFFER_TOO_SMALL
for user to obtain and set the required data buffer size.

Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 efi_runtime/efi_runtime.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Alex Hung Aug. 10, 2016, 3:05 a.m. UTC | #1
On 2016-08-08 05:40 PM, Ivan Hu wrote:
> Data size is required to return when getting the EFI_BUFFER_TOO_SMALL
> for user to obtain and set the required data buffer size.
>
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  efi_runtime/efi_runtime.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/efi_runtime/efi_runtime.c b/efi_runtime/efi_runtime.c
> index c73d968..8c77c77 100644
> --- a/efi_runtime/efi_runtime.c
> +++ b/efi_runtime/efi_runtime.c
> @@ -235,6 +235,10 @@ static long efi_runtime_get_variable(unsigned long arg)
>  		if (dz && put_user(datasize, getvariable_local.data_size))
>  			return -EFAULT;
>  		return 0;
> +	} else if (status == EFI_BUFFER_TOO_SMALL) {
> +		if (dz && put_user(datasize, getvariable_local.data_size))
> +			return -EFAULT;
> +		return -EINVAL;
>  	} else {
>  		return -EINVAL;
>  	}
>

Acked-by: Alex Hung <alex.hung@canonical.com>
Colin Ian King Aug. 11, 2016, 8:48 a.m. UTC | #2
On 08/08/16 10:40, Ivan Hu wrote:
> Data size is required to return when getting the EFI_BUFFER_TOO_SMALL
> for user to obtain and set the required data buffer size.
> 
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  efi_runtime/efi_runtime.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/efi_runtime/efi_runtime.c b/efi_runtime/efi_runtime.c
> index c73d968..8c77c77 100644
> --- a/efi_runtime/efi_runtime.c
> +++ b/efi_runtime/efi_runtime.c
> @@ -235,6 +235,10 @@ static long efi_runtime_get_variable(unsigned long arg)
>  		if (dz && put_user(datasize, getvariable_local.data_size))
>  			return -EFAULT;
>  		return 0;
> +	} else if (status == EFI_BUFFER_TOO_SMALL) {
> +		if (dz && put_user(datasize, getvariable_local.data_size))
> +			return -EFAULT;
> +		return -EINVAL;
>  	} else {
>  		return -EINVAL;
>  	}
> 
Acked-by: Colin Ian King <colin.king@canonical.com>
diff mbox

Patch

diff --git a/efi_runtime/efi_runtime.c b/efi_runtime/efi_runtime.c
index c73d968..8c77c77 100644
--- a/efi_runtime/efi_runtime.c
+++ b/efi_runtime/efi_runtime.c
@@ -235,6 +235,10 @@  static long efi_runtime_get_variable(unsigned long arg)
 		if (dz && put_user(datasize, getvariable_local.data_size))
 			return -EFAULT;
 		return 0;
+	} else if (status == EFI_BUFFER_TOO_SMALL) {
+		if (dz && put_user(datasize, getvariable_local.data_size))
+			return -EFAULT;
+		return -EINVAL;
 	} else {
 		return -EINVAL;
 	}