From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: redhat.com, ip: 209.132.183.28, mailfrom: philmd@redhat.com) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by groups.io with SMTP; Fri, 20 Sep 2019 07:56:54 -0700 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 42467A707 for ; Fri, 20 Sep 2019 14:56:53 +0000 (UTC) Received: by mail-wm1-f70.google.com with SMTP id g82so1325773wmg.9 for ; Fri, 20 Sep 2019 07:56:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Gpx4a1mQHj7BB4EEk/1/Naqbub2AZrbhCwW/bC6DTLA=; b=AGugO5jB0P04YVdtDiopkNRZ03XAkQBst+j0TX2tEtw9xOZfpVJMlwDGR+zoA+l60q /zdC3ltkTM2wwEKzJ86HHD63aRl1NKdG1i7BtxyVMA3dP3hDYqJr4yeYtI/NnBrk6cbl lQ+2uAITaAF3+m6wJ04I3H3orxLlXJPcXw3RL6QX+UUYxtUxIK591gWHL3BVppDXLdgY eYZOwCRQ45p7XSxu08Nj3Q6CrSU9VucN+OSNJNBzSbd+ZFPt2pb1lGxcZSxaQtIipUc8 JOj8xIl4ZHVKt4gk/2UEivoSbhtiHROtP6EreP8nq1em7EAtuLzOLBRCkfbxDctfzDOk KNEw== X-Gm-Message-State: APjAAAXtMu65PqSHAomzSI3+f5Ye3pcEoIxgp7jTn+0ezCxhBVX6icLC M+EwnwoOKwZQjh1/112GfVd26/bEiMk1VI5xZPYpeLN2azwhIii9FGrJNtZWcWDHm/8szr1Vku+ TA3JQLtQnN3RBRw== X-Received: by 2002:a1c:7c15:: with SMTP id x21mr4132975wmc.154.1568991411976; Fri, 20 Sep 2019 07:56:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqw4H65uvnwc18mR3T2X/4Dw0BVxjeisS1wyfowdbgHY1DU6VSca5Yar3nAZw3hVNKvfgUhJFw== X-Received: by 2002:a1c:7c15:: with SMTP id x21mr4132963wmc.154.1568991411795; Fri, 20 Sep 2019 07:56:51 -0700 (PDT) Received: from [192.168.1.40] (240.red-88-21-68.staticip.rima-tde.net. [88.21.68.240]) by smtp.gmail.com with ESMTPSA id g24sm2581754wrb.35.2019.09.20.07.56.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 20 Sep 2019 07:56:51 -0700 (PDT) Subject: Re: [edk2-devel] [PATCH 24/35] OvmfPkg/PlatformDxe: fix EFI_HII_HANDLE parameters of internal functions To: devel@edk2.groups.io, lersek@redhat.com Cc: Ard Biesheuvel , Jordan Justen References: <20190917194935.24322-1-lersek@redhat.com> <20190917194935.24322-25-lersek@redhat.com> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Openpgp: id=89C1E78F601EE86C867495CBA2A3FD6EDEADC0DE; url=http://pgp.mit.edu/pks/lookup?op=get&search=0xA2A3FD6EDEADC0DE Message-ID: Date: Fri, 20 Sep 2019 16:56:50 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20190917194935.24322-25-lersek@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 9/17/19 9:49 PM, Laszlo Ersek wrote: > In the following call tree: > > PlatformInit () > mInstalledPackages = HiiAddPackages () > GopInstalled () > PopulateForm (PackageList = mInstalledPackages) > CreateResolutionOptions (PackageList) > HiiSetString (PackageList > HiiUpdateForm (PackageList) > > PlatformDxe passes around an EFI_HII_HANDLE that (a) originates from > HiiAddPackages() and (b) is ultimately passed to HiiSetString() and > HiiUpdateForm(). The intermediate functions PopulateForm() and > CreateResolutionOptions() however take that parameter as an > (EFI_HII_HANDLE*). > > There is no bug in practice (because the affected functions never try to > de-reference the "PackageList" parameter, they just pass it on), but the > function prototypes are semantically wrong. Fix that. > > This could remain hidden so long because pointer-to-VOID silently converts > to/from any pointer-to-object type, and the UEFI spec mandates that > EFI_HII_HANDLE be a typedef to (VOID*). > > Cc: Ard Biesheuvel > Cc: Jordan Justen > Signed-off-by: Laszlo Ersek Reviewed-by: Philippe Mathieu-Daude > --- > > Notes: > tested in UiApp > > OvmfPkg/PlatformDxe/Platform.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/OvmfPkg/PlatformDxe/Platform.c b/OvmfPkg/PlatformDxe/Platform.c > index 09181769babf..23ad43901f66 100644 > --- a/OvmfPkg/PlatformDxe/Platform.c > +++ b/OvmfPkg/PlatformDxe/Platform.c > @@ -486,7 +486,7 @@ STATIC > EFI_STATUS > EFIAPI > CreateResolutionOptions ( > - IN EFI_HII_HANDLE *PackageList, > + IN EFI_HII_HANDLE PackageList, > OUT VOID **OpCodeBuffer, > IN UINTN NumGopModes, > IN GOP_MODE *GopModes > @@ -547,7 +547,7 @@ STATIC > EFI_STATUS > EFIAPI > PopulateForm ( > - IN EFI_HII_HANDLE *PackageList, > + IN EFI_HII_HANDLE PackageList, > IN EFI_GUID *FormSetGuid, > IN EFI_FORM_ID FormId, > IN UINTN NumGopModes, >