Re: [PATCH v2 1/2] efi/capsule: Add 'capsule' lookup support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2 March 2017 at 16:45, Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx> wrote:
> On 2 March 2017 at 16:44, Matt Fleming <matt@xxxxxxxxxxxxxxxxxxx> wrote:
>> On Thu, 02 Mar, at 03:38:51PM, Ard Biesheuvel wrote:
>>>
>>> > +       if (!capsule)
>>> > +               return -ENOMEM;
>>> > +
>>> > +       capsule += sizeof(uint32_t);
>>>
>>> This is incorrect for 64-bit. You need to increment by the size of
>>> unsigned long here, regardless of the size of efi_capsule_num.
>>
>> I'm almost positive this is correct, but I can't find the bit in the
>> spec that says why. We're not trying to step over a pointer here, if
>> memory serves, it's a capsule count or something and uint32_t is the
>> right type.
>>
>
> Yes, but the next struct member is an array of pointers, so you need
> to advance 8 bytes to get to it due to its alignment

>From EDK2:

typedef struct {
  ///
  /// the size of the array of capsules.
  ///
  UINT32   CapsuleArrayNumber;
  ///
  /// Point to an array of capsules that contain the same CapsuleGuid value.
  ///
  VOID*    CapsulePtr[1];
} EFI_CAPSULE_TABLE;
--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux