From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.43406.1597672477701910269 for ; Mon, 17 Aug 2020 06:54:38 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ard.biesheuvel@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BDECC30E; Mon, 17 Aug 2020 06:54:36 -0700 (PDT) Received: from [192.168.178.54] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6DC243F6CF; Mon, 17 Aug 2020 06:54:35 -0700 (PDT) Subject: Re: [edk2-platform][PATCH v1 1/3] Platforms/RaspberryPi: Fix DisplayDxe ComponentName2 error checking To: Samer El-Haj-Mahmoud , devel@edk2.groups.io Cc: Leif Lindholm , Pete Batard , Andrei Warkentin References: <20200815202631.29690-1-Samer.El-Haj-Mahmoud@arm.com> <20200815202631.29690-2-Samer.El-Haj-Mahmoud@arm.com> From: "Ard Biesheuvel" Message-ID: Date: Mon, 17 Aug 2020 15:54:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200815202631.29690-2-Samer.El-Haj-Mahmoud@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit On 8/15/20 10:26 PM, Samer El-Haj-Mahmoud wrote: > Fix input param error checking for the DisplayDxe ComponentName2 > protocol. > > This fixes https://github.com/pftf/RPi4/issues/84 > > Cc: Leif Lindholm > Cc: Pete Batard > Cc: Andrei Warkentin > Cc: Ard Biesheuvel > Signed-off-by: Samer El-Haj-Mahmoud > --- > Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.h | 2 ++ > Platform/RaspberryPi/Drivers/DisplayDxe/ComponentName.c | 22 ++++++++++++++++++++ > 2 files changed, 24 insertions(+) > Please use a cover letter for multipatch series. Series pushed as c475b1bbda25..69009e5b91a7 (with Pete's comments addressed) Thanks, > diff --git a/Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.h b/Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.h > index bfbe9e868843..073f65111645 100644 > --- a/Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.h > +++ b/Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.h > @@ -1,5 +1,6 @@ > /** @file > * > + * Copyright (c) 2020, ARM Limited. All rights reserved. > * Copyright (c) 2017-2018, Andrei Warkentin > * Copyright (c) Microsoft Corporation. All rights reserved. > * > @@ -27,6 +28,7 @@ > extern EFI_GRAPHICS_OUTPUT_PROTOCOL gDisplayProto; > extern EFI_COMPONENT_NAME_PROTOCOL gComponentName; > extern EFI_COMPONENT_NAME2_PROTOCOL gComponentName2; > +extern EFI_DRIVER_BINDING_PROTOCOL mDriverBinding; > > VOID > RegisterScreenshotHandlers ( > diff --git a/Platform/RaspberryPi/Drivers/DisplayDxe/ComponentName.c b/Platform/RaspberryPi/Drivers/DisplayDxe/ComponentName.c > index 092230cd7c9b..4c065b5d51bf 100644 > --- a/Platform/RaspberryPi/Drivers/DisplayDxe/ComponentName.c > +++ b/Platform/RaspberryPi/Drivers/DisplayDxe/ComponentName.c > @@ -1,5 +1,6 @@ > /** @file > * > + * Copyright (c) 2020, ARM Limited. All rights reserved. > * Copyright (c) 2018, Andrei Warkentin > * Copyright (c) 2006-2016, Intel Corporation. All rights reserved. > * > @@ -206,6 +207,27 @@ ComponentNameGetControllerName ( > OUT CHAR16 **ControllerName > ) > { > + EFI_STATUS Status; > + > + // > + // This is a device driver, so ChildHandle must be NULL. > + // > + if (ChildHandle != NULL) { > + return EFI_UNSUPPORTED; > + } > + > + // > + // Make sure this driver is currently managing ControllHandle > + // > + Status = EfiTestManagedDevice ( > + ControllerHandle, > + mDriverBinding.DriverBindingHandle, > + &gEfiGraphicsOutputProtocolGuid > + ); > + if (EFI_ERROR (Status)) { > + return Status; > + } > + > return LookupUnicodeString2 ( > Language, > This->SupportedLanguages, >