diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2015-01-08 12:51:47 -0500 |
---|---|---|
committer | Matt Fleming <matt.fleming@intel.com> | 2015-01-20 17:13:33 -0500 |
commit | d1a8d66b9177105e898e73716f97eb61842c457a (patch) | |
tree | 743fa621077ce787e58a98d0b9a9b803df25f2b3 /drivers/media/dvb-frontends/dib8000.h | |
parent | 86d68a58d00db3770735b5919ef2c6b12d7f06f3 (diff) |
efi/libstub: Call get_memory_map() to obtain map and desc sizes
This fixes two minor issues in the implementation of get_memory_map():
- Currently, it assumes that sizeof(efi_memory_desc_t) == desc_size,
which is usually true, but not mandated by the spec. (This was added
intentionally to allow future additions to the definition of
efi_memory_desc_t). The way the loop is implemented currently, the
added slack space may be insufficient if desc_size is larger, which in
some corner cases could result in the loop never terminating.
- It allocates 32 efi_memory_desc_t entries first (again, using the size
of the struct instead of desc_size), and frees and reallocates if it
turns out to be insufficient. Few implementations of UEFI have such small
memory maps, which results in a unnecessary allocate/free pair on each
invocation.
Fix this by calling the get_memory_map() boot service first with a '0'
input value for map size to retrieve the map size and desc size from the
firmware and only then perform the allocation, using desc_size rather
than sizeof(efi_memory_desc_t).
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'drivers/media/dvb-frontends/dib8000.h')
0 files changed, 0 insertions, 0 deletions