From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from cam-smtp0.cambridge.arm.com (cam-smtp0.cambridge.arm.com [217.140.106.53]) by mx.groups.io with SMTP id smtpd.web12.12711.1593514150733839398 for ; Tue, 30 Jun 2020 03:49:11 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.106.53, mailfrom: pierre.gondois@arm.com) Received: from E119881.Arm.com (E119881.Arm.com [10.1.197.28]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id 05UAn70u025781; Tue, 30 Jun 2020 11:49:07 +0100 From: "PierreGondois" To: devel@edk2.groups.io Cc: Pierre Gondois , leif@nuviainc.com, ard.biesheuvel@arm.com, nd@arm.com Subject: [PATCH v1 2/2] EmbeddedPkg: Add cast from (void*) for VS2017 build Date: Tue, 30 Jun 2020 11:49:01 +0100 Message-Id: <20200630104901.11648-3-pierre.gondois@arm.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20200630104901.11648-1-pierre.gondois@arm.com> References: <20200630104901.11648-1-pierre.gondois@arm.com> From: Pierre Gondois 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 --- 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.
+ Copyright (c) 2013-2020, ARM Ltd. All rights reserved.
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)'