public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb@kernel.org>
To: Sami Mujawar <sami.mujawar@arm.com>
Cc: edk2-devel-groups-io <devel@edk2.groups.io>,
	Leif Lindholm <leif@nuviainc.com>,
	 Thomas Panakamattam Abraham <thomas.abraham@arm.com>,
	Matteo Carlini <Matteo.Carlini@arm.com>,
	 Laura Moretta <Laura.Moretta@arm.com>, nd <nd@arm.com>
Subject: Re: [PATCH edk2-platforms v1 1/1] Platform/ARM: Fix uninitialized variable in RunAxf
Date: Mon, 6 Apr 2020 11:51:04 +0200	[thread overview]
Message-ID: <CAKv+Gu8J2NW_8n3e30w=QJFZtuOWfXMNNL12dv0Xk3UPAGCOHA@mail.gmail.com> (raw)
In-Reply-To: <20200403160436.37896-1-sami.mujawar@arm.com>

On Fri, 3 Apr 2020 at 18:05, Sami Mujawar <sami.mujawar@arm.com> wrote:
>
> RunAxf is a shell command used for running an Axf
> file. The ShellDynCmdRunAxfHandler() loads an ELF
> file or one processed by the Flashloader. It
> calls the appropriate loaders to load the file
> in memory and to obtain the entry point address.
>
> The first argument to RunAxfPivot() is the entry
> point address for the image to execute. The patch
> https://github.com/tianocore/edk2-platforms/commit/996047695a06167a918b07b22fcd0fbd0def5da6
> changes set/way cache maintenance operations
> to by-VA operation. This patch however introduced
> an error: 'variable StartElf is not initialized'.
>
> Since, StartElf is the first argument to
> RunAxfPivot(), which is expected to be the entry
> point address; RunAxfPivot() would end up branching
> to an invalid address resulting in a crash.
>
> Therefore, initialize StartElf to the entry point
> address before calling RunAxfPivot().
>
> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>

Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>

Pushed as 5780623dc5c8..1d59c5b912d9

Thanks Sami


> ---
>
> The changes can be seen at:
> https://github.com/samimujawar/edk2-platforms/tree/769_runaxf_fix_uninit_var_v1
>
> Notes:
>     V1:
>     - Fix uninitialized variable usage in RunAxf                    [SAMI]
>
>  Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c b/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c
> index dbad50ae866ac91d796b70ce7eed1dda4ab99957..d23739ad38d922ea16b5dc615604e9016c30fcbe 100644
> --- a/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c
> +++ b/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c
> @@ -2,7 +2,7 @@
>  *
>  *  Shell command for launching AXF files.
>  *
> -*  Copyright (c) 2014, ARM Limited. All rights reserved.
> +*  Copyright (c) 2014 - 2020, ARM Limited. All rights reserved.
>  *
>  *  SPDX-License-Identifier: BSD-2-Clause-Patent
>  *
> @@ -315,6 +315,7 @@ ShellDynCmdRunAxfHandler (
>        //
>        WriteBackDataCacheRange (LoadedImage->ImageBase, LoadedImage->ImageSize);
>
> +      StartElf = (ELF_ENTRYPOINT)Entrypoint;
>        RunAxfPivot (StartElf, 0, 0, 0, 0);
>
>        // We should never get here.. But if we do, spin..
> --
> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
>

      reply	other threads:[~2020-04-06  9:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-03 16:04 [PATCH edk2-platforms v1 1/1] Platform/ARM: Fix uninitialized variable in RunAxf Sami Mujawar
2020-04-06  9:51 ` Ard Biesheuvel [this message]

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='CAKv+Gu8J2NW_8n3e30w=QJFZtuOWfXMNNL12dv0Xk3UPAGCOHA@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