public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ardb@kernel.org>
To: devel@edk2.groups.io, n.jayaprakash@intel.com
Cc: Rebecca Cran <rebecca@bsdio.com>,
	Michael D Kinney <michael.d.kinney@intel.com>,
	 Laszlo Ersek <lersek@redhat.com>,
	Leif Lindholm <quic_llindhol@quicinc.com>,
	 Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Abner Chang <abner.chang@amd.com>
Subject: Re: [edk2-devel] [edk2 Patch 1/1] EmbeddedPkg: compiler error due to arithmetic operation on void pointer
Date: Tue, 6 Feb 2024 12:57:40 +0000	[thread overview]
Message-ID: <CAMj1kXEKJ2b7jmLkXOh2MszT=PL3Oc+VL-8iTmpQ3eZoX_YBUg@mail.gmail.com> (raw)
In-Reply-To: <20240206052320.1233-2-n.jayaprakash@intel.com>

On Tue, 6 Feb 2024 at 05:23, Jayaprakash, N <n.jayaprakash@intel.com> wrote:
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4668
>
> This commit fixes the issue reported in the BZ4668.
> The EmbeddedPkg fails to compile with a compiler error
> generated due to invalid/illegal arithmetic operation
> on void pointers. It has been fixed by using explicit
> type conversion of the void pointer to UINTN.
>
> Cc: Rebecca Cran <rebecca@bsdio.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Leif Lindholm <quic_llindhol@quicinc.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Jayaprakash N <n.jayaprakash@intel.com>
> Signed-off-by: Jayaprakash N <n.jayaprakash@intel.com>
> ---
>  .../Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c      | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
> index fa81cc9d59..11566cf57f 100644
> --- a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
> +++ b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
> @@ -308,7 +308,7 @@ ReallocatePool (
>    if (OldBuffer != NULL) {
>      HandOffHob = GetHobList ();
>      ASSERT (((EFI_PHYSICAL_ADDRESS)(UINTN)OldBuffer >= HandOffHob->EfiMemoryBottom));
> -    ASSERT (((EFI_PHYSICAL_ADDRESS)(UINTN)(OldBuffer + OldSize) <= HandOffHob->EfiFreeMemoryBottom));
> +    ASSERT (((EFI_PHYSICAL_ADDRESS)(UINTN)((UINTN)OldBuffer + OldSize) <= HandOffHob->EfiFreeMemoryBottom));


Do we really need two UINTN casts here?


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115158): https://edk2.groups.io/g/devel/message/115158
Mute This Topic: https://groups.io/mt/104193285/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  reply	other threads:[~2024-02-06 12:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-06  5:23 [edk2-devel] [edk2 Patch 0/1] fix compiler error due to void pointer arithmetic Jayaprakash, N
2024-02-06  5:23 ` [edk2-devel] [edk2 Patch 1/1] EmbeddedPkg: compiler error due to arithmetic operation on void pointer Jayaprakash, N
2024-02-06 12:57   ` Ard Biesheuvel [this message]
2024-02-06 14:36     ` Laszlo Ersek
2024-02-06 15:55       ` Jayaprakash, N
2024-02-07 14:21         ` Laszlo Ersek
2024-02-07 14:40           ` Jayaprakash, N

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMj1kXEKJ2b7jmLkXOh2MszT=PL3Oc+VL-8iTmpQ3eZoX_YBUg@mail.gmail.com' \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox