From: Pierre Gondois <pierre.gond...@arm.com> By default, gcc allows void* pointer arithmetic. This is a GCC extension. However, the C reference manual states that void* pointer "cannot be operands of addition or subtraction operators". Cf s5.3.1 "Generic Pointers".
This patch adds casts to avoid doing void* pointer arithmetic. Signed-off-by: Pierre Gondois <pierre.gond...@arm.com> --- The changes can be seen at: https://github.com/PierreARM/edk2-platforms/commits/Casts_avoiding_void_pointer_arith_v1 Notes: v1: - Use casts to avoid void* pointer arithmetic. [Pierre] Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/DriverBinding.c | 3 ++- Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/DwEmacSnpDxe.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/DriverBinding.c b/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/DriverBinding.c index bdf885458197887e198dcba83355c8a8631d9e58..f1a9771f066983c3152bc72ce5c2cf6fa12de95e 100755 --- a/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/DriverBinding.c +++ b/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/DriverBinding.c @@ -1,6 +1,7 @@ /** @file Copyright (c) 2011 - 2019, Intel Corporaton. All rights reserved. + Copyright (c) 2020, Arm Limited. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -171,7 +172,7 @@ DriverStart ( } //DMA mapping for receive buffer - RxBufferAddr = (VOID *)Snp->MacDriver.RxBuffer + (Index * BufferSize); + RxBufferAddr = (UINTN*)((UINTN)Snp->MacDriver.RxBuffer + (Index * BufferSize)); Status = DmaMap (MapOperationBusMasterWrite, (VOID *) RxBufferAddr, &BufferSize, &RxBufferAddrMap, &Snp->MacDriver.RxBufNum[Index].Mapping); if (EFI_ERROR (Status)) { diff --git a/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/DwEmacSnpDxe.c b/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/DwEmacSnpDxe.c index 09e6754798a048f6dc3c40086039ca836dfb9540..4cb3371d79bbdc23735f85826ce35e5d71dbcdf9 100755 --- a/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/DwEmacSnpDxe.c +++ b/Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/DwEmacSnpDxe.c @@ -5,7 +5,7 @@ The original software modules are licensed as follows: - Copyright (c) 2012 - 2014, ARM Limited. All rights reserved. + Copyright (c) 2012 - 2020, Arm Limited. All rights reserved.<BR> Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -1135,7 +1135,8 @@ SnpReceive ( Snp->MacDriver.RxCurrentDescriptorNum = Snp->MacDriver.RxNextDescriptorNum; DescNum = Snp->MacDriver.RxCurrentDescriptorNum; RxDescriptor = Snp->MacDriver.RxdescRing[DescNum]; - RxBufferAddr = (VOID *)Snp->MacDriver.RxBuffer + (DescNum * BufferSizeBuf); + RxBufferAddr = (UINTN*)((UINTN)Snp->MacDriver.RxBuffer + + (DescNum * BufferSizeBuf)); RxDescriptorMap = (VOID *)(UINTN)Snp->MacDriver.RxdescRingMap[DescNum].AddrMap; RawData = (UINT8 *) Data; -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#63519): https://edk2.groups.io/g/devel/message/63519 Mute This Topic: https://groups.io/mt/75893336/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-