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