efidisk: Respect block_io_protocol buffer alignment
authorLeif Lindholm <leif.lindholm@linaro.org>
Sat, 27 Feb 2016 12:44:59 +0000 (13:44 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Sat, 27 Feb 2016 12:44:59 +0000 (13:44 +0100)
commit51f375d688529b7c1819ba40188ee52b9333887c
tree67fb223e0a9255f97aee3b6572b93e4ddd200039
parentca028db3d47387bbbd24b40f085751ca98a09183
efidisk: Respect block_io_protocol buffer alignment

Returned from the OpenProtocol operation, the grub_efi_block_io_media
structure contains the io_align field, specifying the minimum alignment
required for buffers used in any data transfers with the device.

Make grub_efidisk_readwrite() allocate a temporary buffer, aligned to
this boundary, if the buffer passed to it does not already meet the
requirements.

Also sanity check the io_align field in grub_efidisk_open() for
power-of-two-ness and bail if invalid.
grub-core/disk/efi/efidisk.c