From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mx.groups.io with SMTP id smtpd.web12.7683.1586166677655762894 for ; Mon, 06 Apr 2020 02:51:17 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=default header.b=DsY4k1Rw; spf=pass (domain: kernel.org, ip: 198.145.29.99, mailfrom: ardb@kernel.org) Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EA750206F8 for ; Mon, 6 Apr 2020 09:51:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586166677; bh=Ek10F+lcsH1sQwF2AhcPcvJkWrOYBusFZEJbcZS6zm8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=DsY4k1RwtLteynwU044bmx12YYX6Y3cNxuC5u+2M5vebfp3FWZRU3R0lLK/anVGJq 1FNcR4KGYp7L9NgcVTatbRDDhw6JgJhw7hrzeh7lyjukp/YOq+J0COlINHCjyZoE5U u4GPhLvxWlPKt5QcOESuX61CAk0kNyCU69sgXX88= Received: by mail-wm1-f53.google.com with SMTP id h2so6005723wmb.4 for ; Mon, 06 Apr 2020 02:51:16 -0700 (PDT) X-Gm-Message-State: AGi0PuYp2R3UBVSooaolI/m0En8Y89bO+4Wsh2ab/IgyU05BMNEj50v0 PEpUDOEPFofKBKVjIyahGg5zodkViMMQn4TXjpN+Yw== X-Google-Smtp-Source: APiQypLHLiXwVGaX5ck+725Alun2cz7qC1I3uwLj+7WfeJYhGtNFbi+1t7+cw0NFsjferSzOs40MGzxSSeG1lnGIJKc= X-Received: by 2002:a1c:ac8a:: with SMTP id v132mr20913120wme.62.1586166675396; Mon, 06 Apr 2020 02:51:15 -0700 (PDT) MIME-Version: 1.0 References: <20200403160436.37896-1-sami.mujawar@arm.com> In-Reply-To: <20200403160436.37896-1-sami.mujawar@arm.com> From: Ard Biesheuvel Date: Mon, 6 Apr 2020 11:51:04 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH edk2-platforms v1 1/1] Platform/ARM: Fix uninitialized variable in RunAxf To: Sami Mujawar Cc: edk2-devel-groups-io , Leif Lindholm , Thomas Panakamattam Abraham , Matteo Carlini , Laura Moretta , nd Content-Type: text/plain; charset="UTF-8" On Fri, 3 Apr 2020 at 18:05, Sami Mujawar 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 Reviewed-by: Ard Biesheuvel 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)' >