ACK: [PATCH 2/3] efi_runtime: reuse the in-kernel capsule header structure
Colin Ian King
colin.king at canonical.com
Wed Jul 6 09:56:09 UTC 2016
On 06/07/16 10:51, Ivan Hu wrote:
> reuse the in-kernel capsule header structure efi_capsule_header_t instead of
> making our own.
>
> Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
> ---
> efi_runtime/efi_runtime.c | 8 ++++----
> efi_runtime/efi_runtime.h | 9 +--------
> 2 files changed, 5 insertions(+), 12 deletions(-)
>
> diff --git a/efi_runtime/efi_runtime.c b/efi_runtime/efi_runtime.c
> index 4c83800..1aa4012 100644
> --- a/efi_runtime/efi_runtime.c
> +++ b/efi_runtime/efi_runtime.c
> @@ -564,7 +564,7 @@ static long efi_runtime_query_capsulecaps(unsigned long arg)
> {
> struct efi_querycapsulecapabilities __user *u_caps;
> struct efi_querycapsulecapabilities caps;
> - EFI_CAPSULE_HEADER *capsules;
> + efi_capsule_header_t *capsules;
> efi_status_t status;
> uint64_t max_size;
> int i, reset_type;
> @@ -575,12 +575,12 @@ static long efi_runtime_query_capsulecaps(unsigned long arg)
> return -EFAULT;
>
> capsules = kcalloc(caps.CapsuleCount + 1,
> - sizeof(EFI_CAPSULE_HEADER), GFP_KERNEL);
> + sizeof(efi_capsule_header_t), GFP_KERNEL);
> if (!capsules)
> return -ENOMEM;
>
> for (i = 0; i < caps.CapsuleCount; i++) {
> - EFI_CAPSULE_HEADER *c;
> + efi_capsule_header_t *c;
> /*
> * We cannot dereference caps.CapsuleHeaderArray directly to
> * obtain the address of the capsule as it resides in the
> @@ -588,7 +588,7 @@ static long efi_runtime_query_capsulecaps(unsigned long arg)
> */
> if (get_user(c, caps.CapsuleHeaderArray + i))
> return -EFAULT;
> - if (copy_from_user(&capsules[i], c, sizeof(EFI_CAPSULE_HEADER)))
> + if (copy_from_user(&capsules[i], c, sizeof(efi_capsule_header_t)))
> return -EFAULT;
> }
>
> diff --git a/efi_runtime/efi_runtime.h b/efi_runtime/efi_runtime.h
> index b9177d4..e369981 100644
> --- a/efi_runtime/efi_runtime.h
> +++ b/efi_runtime/efi_runtime.h
> @@ -29,13 +29,6 @@ typedef enum {
> EfiResetShutdown
> } EFI_RESET_TYPE;
>
> -typedef struct {
> - efi_guid_t CapsuleGuid;
> - uint32_t HeaderSize;
> - uint32_t Flags;
> - uint32_t CapsuleImageSize;
> -} __attribute__ ((packed)) EFI_CAPSULE_HEADER;
> -
> struct efi_getvariable {
> uint16_t *VariableName;
> efi_guid_t *VendorGuid;
> @@ -99,7 +92,7 @@ struct efi_getnexthighmonotoniccount {
> } __attribute__ ((packed));
>
> struct efi_querycapsulecapabilities {
> - EFI_CAPSULE_HEADER **CapsuleHeaderArray;
> + efi_capsule_header_t **CapsuleHeaderArray;
> uint64_t CapsuleCount;
> uint64_t *MaximumCapsuleSize;
> EFI_RESET_TYPE *ResetType;
>
Acked-by: Colin Ian King <colin.king at canonical.com>
More information about the fwts-devel
mailing list