Message ID | 1491046162-53797-2-git-send-email-chenhui.sun@linaro.org |
---|---|
State | New |
Headers | show |
Series | D03/D05 platforms bug fix | expand |
On Sat, Apr 01, 2017 at 07:29:06PM +0800, Chenhui Sun wrote: > The size of the updated DTB file may be increased, so we need to allocate > more memory than the original DTB size,or memory overflow may happen. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: shaochangliang <shaochangliang@huawei.com> > Signed-off-by: Heyi Guo <heyi.guo@linaro.org> > Signed-off-by: Yi Li <phoenix.liyi@huawei.com> > Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org> Thanks, pushed as bb301e7ef8. > --- > Chips/Hisilicon/Drivers/UpdateFdtDxe/UpdateFdtDxe.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/Chips/Hisilicon/Drivers/UpdateFdtDxe/UpdateFdtDxe.c b/Chips/Hisilicon/Drivers/UpdateFdtDxe/UpdateFdtDxe.c > index 8586e33..699a820 100644 > --- a/Chips/Hisilicon/Drivers/UpdateFdtDxe/UpdateFdtDxe.c > +++ b/Chips/Hisilicon/Drivers/UpdateFdtDxe/UpdateFdtDxe.c > @@ -112,7 +112,7 @@ EFIAPI UpdateFdt ( > Size = (UINTN)fdt_totalsize ((VOID*)(PcdGet64(FdtFileAddress))); > NewFdtBlobSize = Size + ADD_FILE_LENGTH; > > - Status = gBS->AllocatePages (AllocateAnyPages, EfiRuntimeServicesData, EFI_SIZE_TO_PAGES(Size), &NewFdtBlobBase); > + Status = gBS->AllocatePages (AllocateAnyPages, EfiRuntimeServicesData, EFI_SIZE_TO_PAGES(NewFdtBlobSize), &NewFdtBlobBase); > if (EFI_ERROR (Status)) > { > return EFI_OUT_OF_RESOURCES; > -- > 1.9.1 >
diff --git a/Chips/Hisilicon/Drivers/UpdateFdtDxe/UpdateFdtDxe.c b/Chips/Hisilicon/Drivers/UpdateFdtDxe/UpdateFdtDxe.c index 8586e33..699a820 100644 --- a/Chips/Hisilicon/Drivers/UpdateFdtDxe/UpdateFdtDxe.c +++ b/Chips/Hisilicon/Drivers/UpdateFdtDxe/UpdateFdtDxe.c @@ -112,7 +112,7 @@ EFIAPI UpdateFdt ( Size = (UINTN)fdt_totalsize ((VOID*)(PcdGet64(FdtFileAddress))); NewFdtBlobSize = Size + ADD_FILE_LENGTH; - Status = gBS->AllocatePages (AllocateAnyPages, EfiRuntimeServicesData, EFI_SIZE_TO_PAGES(Size), &NewFdtBlobBase); + Status = gBS->AllocatePages (AllocateAnyPages, EfiRuntimeServicesData, EFI_SIZE_TO_PAGES(NewFdtBlobSize), &NewFdtBlobBase); if (EFI_ERROR (Status)) { return EFI_OUT_OF_RESOURCES;