Message ID | 1364809003-7402-1-git-send-email-ivan.hu@canonical.com |
---|---|
State | Accepted |
Headers | show |
On 01/04/13 10:36, Ivan Hu wrote: > The UEFI variable test on fwts, we test the getnextvariable implementation that > when EFI_BUFFER_TOO_SMALL error occurs, the VariableNameSize is updated to > reflect the size of buffer needed. > When EFI_BUFFER_TOO_SMALL error occurs, efi_runtime need to first update the the > VariableNameSize, then return error code. so move the return error code later than update code. > > Signed-off-by: Ivan Hu <ivan.hu@canonical.com> > --- > efi_runtime/efi_runtime.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/efi_runtime/efi_runtime.c b/efi_runtime/efi_runtime.c > index 9440aae..db4a465 100644 > --- a/efi_runtime/efi_runtime.c > +++ b/efi_runtime/efi_runtime.c > @@ -256,8 +256,6 @@ static long efi_runtime_ioctl(struct file *file, unsigned int cmd, > &vendor); > if (put_user(status, pgetnextvariablename->status)) > return -EFAULT; > - if (status != EFI_SUCCESS) > - return -EINVAL; > convert_to_guid(&vendor, &vendor_guid); > > if (put_user(name_size, pgetnextvariablename->VariableNameSize)) > @@ -266,6 +264,8 @@ static long efi_runtime_ioctl(struct file *file, unsigned int cmd, > if (copy_to_user(pgetnextvariablename->VendorGuid, > &vendor_guid, sizeof(EFI_GUID))) > return -EFAULT; > + if (status != EFI_SUCCESS) > + return -EINVAL; > return 0; > > case EFI_RUNTIME_QUERY_VARIABLEINFO: > Acked-by: Colin Ian King <colin.king@canonical.com>
On 04/01/2013 05:36 PM, Ivan Hu wrote: > The UEFI variable test on fwts, we test the getnextvariable implementation that > when EFI_BUFFER_TOO_SMALL error occurs, the VariableNameSize is updated to > reflect the size of buffer needed. > When EFI_BUFFER_TOO_SMALL error occurs, efi_runtime need to first update the the > VariableNameSize, then return error code. so move the return error code later than update code. > > Signed-off-by: Ivan Hu <ivan.hu@canonical.com> > --- > efi_runtime/efi_runtime.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/efi_runtime/efi_runtime.c b/efi_runtime/efi_runtime.c > index 9440aae..db4a465 100644 > --- a/efi_runtime/efi_runtime.c > +++ b/efi_runtime/efi_runtime.c > @@ -256,8 +256,6 @@ static long efi_runtime_ioctl(struct file *file, unsigned int cmd, > &vendor); > if (put_user(status, pgetnextvariablename->status)) > return -EFAULT; > - if (status != EFI_SUCCESS) > - return -EINVAL; > convert_to_guid(&vendor, &vendor_guid); > > if (put_user(name_size, pgetnextvariablename->VariableNameSize)) > @@ -266,6 +264,8 @@ static long efi_runtime_ioctl(struct file *file, unsigned int cmd, > if (copy_to_user(pgetnextvariablename->VendorGuid, > &vendor_guid, sizeof(EFI_GUID))) > return -EFAULT; > + if (status != EFI_SUCCESS) > + return -EINVAL; > return 0; > > case EFI_RUNTIME_QUERY_VARIABLEINFO: > Acked-by: Alex Hung <alex.hung@canonical.com>
diff --git a/efi_runtime/efi_runtime.c b/efi_runtime/efi_runtime.c index 9440aae..db4a465 100644 --- a/efi_runtime/efi_runtime.c +++ b/efi_runtime/efi_runtime.c @@ -256,8 +256,6 @@ static long efi_runtime_ioctl(struct file *file, unsigned int cmd, &vendor); if (put_user(status, pgetnextvariablename->status)) return -EFAULT; - if (status != EFI_SUCCESS) - return -EINVAL; convert_to_guid(&vendor, &vendor_guid); if (put_user(name_size, pgetnextvariablename->VariableNameSize)) @@ -266,6 +264,8 @@ static long efi_runtime_ioctl(struct file *file, unsigned int cmd, if (copy_to_user(pgetnextvariablename->VendorGuid, &vendor_guid, sizeof(EFI_GUID))) return -EFAULT; + if (status != EFI_SUCCESS) + return -EINVAL; return 0; case EFI_RUNTIME_QUERY_VARIABLEINFO:
The UEFI variable test on fwts, we test the getnextvariable implementation that when EFI_BUFFER_TOO_SMALL error occurs, the VariableNameSize is updated to reflect the size of buffer needed. When EFI_BUFFER_TOO_SMALL error occurs, efi_runtime need to first update the the VariableNameSize, then return error code. so move the return error code later than update code. Signed-off-by: Ivan Hu <ivan.hu@canonical.com> --- efi_runtime/efi_runtime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)