From: Pierre Gondois <pierre.gond...@arm.com>

The following build configrations:
build -b DEBUG -a AARCH64 -t VS2017 -p edk2\EmbeddedPkg\EmbeddedPkg.dsc
build -b NOOPT -a AARCH64 -t VS2017 -p edk2\EmbeddedPkg\EmbeddedPkg.dsc
build -b RELEASE -a AARCH64 -t VS2017 -p edk2\EmbeddedPkg\EmbeddedPkg.dsc

are generating the following build errors:
edk2\EmbeddedPkg\Library\AndroidBootImgLib\AndroidBootImgLib.c(100):
error C2036: 'void *': unknown size
edk2\EmbeddedPkg\Library\AndroidBootImgLib\AndroidBootImgLib.c(347):
error C2036: 'void *': unknown size

Since the size of void* depends on the architecture, it can be
dangerous to use void* pointer arithmetic. Plus the C99 doesn't state
that void* pointer arithmetic is allowed.
This patch adds a cast to fix the Visual Studio errors reported.

Signed-off-by: Pierre Gondois <pierre.gond...@arm.com>
---

The changes can be seen at: 
https://github.com/PierreARM/edk2/commits/831_Fix_VS2017_build_error_v1

Notes:
    v1:
     - Fix VS2017 build errors. [Pierre]

 EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c 
b/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c
index 
e1036954ee586dfc30266eec2897d71bfc949038..bbe0d41018b3d5665c72ee61efe737ae57b1b2eb
 100644
--- a/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c
+++ b/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c
@@ -1,6 +1,6 @@
 /** @file
 
-  Copyright (c) 2013-2014, ARM Ltd. All rights reserved.<BR>
+  Copyright (c) 2013-2020, ARM Ltd. All rights reserved.<BR>
   Copyright (c) 2017, Linaro. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -97,7 +97,7 @@ AndroidBootImgGetKernelInfo (
   ASSERT (IS_VALID_ANDROID_PAGE_SIZE (Header->PageSize));
 
   *KernelSize = Header->KernelSize;
-  *Kernel = BootImg + Header->PageSize;
+  *Kernel = (UINT8*)BootImg + Header->PageSize;
   return EFI_SUCCESS;
 }
 
@@ -339,9 +339,12 @@ AndroidBootImgUpdateFdt (
     goto Fdt_Exit;
   }
 
-  Status = AndroidBootImgSetProperty64 (UpdatedFdtBase, ChosenNode,
-                                        "linux,initrd-end",
-                                        (UINTN)(RamdiskData + RamdiskSize));
+  Status = AndroidBootImgSetProperty64 (
+             UpdatedFdtBase,
+             ChosenNode,
+             "linux,initrd-end",
+             (UINTN)((UINT8*)RamdiskData + RamdiskSize)
+             );
   if (EFI_ERROR (Status)) {
     goto Fdt_Exit;
   }
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61832): https://edk2.groups.io/g/devel/message/61832
Mute This Topic: https://groups.io/mt/75211231/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to