MdePkg/BaseMemoryLib*: check for zero length in ZeroMem ()
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 3 Nov 2016 17:29:01 +0000 (17:29 +0000)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 4 Nov 2016 09:53:01 +0000 (09:53 +0000)
commit12a37b2ae19b1edabf390c0744ae0af9bb9d2b9a
treebed19eb1d230a86c1dec90b1e58dd402c98ddc51
parent669b6cc60bf610bbee32e79ed165ca604764c169
MdePkg/BaseMemoryLib*: check for zero length in ZeroMem ()

Unlike other string functions in this library, ZeroMem () does not
return early when the length of the input buffer is 0. So add the
same to ZeroMem () as well, for all implementations of BaseMemoryLib
living under MdePkg/

This fixes an issue with the ARM implementation of BaseMemoryLibOPtDxe,
whose InternalMemZeroMem code does not expect a length of 0, and always
writes at least a single byte.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
MdePkg/Library/BaseMemoryLib/ZeroMemWrapper.c
MdePkg/Library/BaseMemoryLibMmx/ZeroMemWrapper.c
MdePkg/Library/BaseMemoryLibOptDxe/ZeroMemWrapper.c
MdePkg/Library/BaseMemoryLibOptPei/ZeroMemWrapper.c
MdePkg/Library/BaseMemoryLibRepStr/ZeroMemWrapper.c
MdePkg/Library/BaseMemoryLibSse2/ZeroMemWrapper.c
MdePkg/Library/PeiMemoryLib/ZeroMemWrapper.c
MdePkg/Library/UefiMemoryLib/ZeroMemWrapper.c