Thanks for your detailed explanation. Now it is much clearer for me :)

Heyi

On 11/23/2015 09:07 AM, Fu, Siyuan wrote:
Hi, Guo

The input of the FilePath is the remaining part of a boot option compared with 
the PXE handle's device path. That's, when BDS load a boot option, it tries to 
locate the device path to a closest handle (this is make by calling 
LocateDevicePath service), then pass the remaining part of the boot option to 
the load file protocol. For a PXE boot option, it should be ended by an IP 
device path node, like
        PciRoot()/Pci()/Mac()/IPv4()
Which is same as the PXE handle's device path, so the remaining part should be 
just an end node.
But in the case the platform also support HTTP boot, a HTTP boot option is like
        PciRoot()/Pci()/Mac()/IPv4()/Uri()
Please note that the former part is exactly same as a PXE boot option, so BDS 
may locate this HTTP boot option to a PXE handle by mistake, and pass the Uri() 
node as the FilePath parameter. PXE driver should not handle this kind of 
FilePath so we add this fix.
Of cause the BDS driver need some updates to avoid this mistake, it's under 
work now.

Best Regards
Siyuan

-----Original Message-----
From: Heyi Guo [mailto:heyi....@linaro.org]
Sent: Friday, November 20, 2015 5:10 PM
To: Fu, Siyuan <siyuan...@intel.com>; edk2-devel@lists.01.org
Cc: Zhang, Lubo <lubo.zh...@intel.com>; Tian, Feng <feng.t...@intel.com>
Subject: Re: [edk2] [PATCH] MdeModulePkg/Pxe: Fix bug of checking input FilePath

Sorry I missed to see FilePath is not used in the function at all.

However, I'd like to know where this requirement comes from? I searched in the 
section of load file protocol and didn't find such requirement.

Thanks.

Heyi

On 11/20/2015 04:50 PM, Fu, Siyuan wrote:
Hi, Guo

It's not a bug, for EfiPxeLoadFile function the input FilePath should always be 
an end device path node.


-----Original Message-----
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
Heyi Guo
Sent: Friday, November 20, 2015 4:23 PM
To: edk2-devel@lists.01.org
Cc: Zhang, Lubo <lubo.zh...@intel.com>; Heyi Guo
<heyi....@linaro.org>; Tian, Feng <feng.t...@intel.com>
Subject: [edk2] [PATCH] MdeModulePkg/Pxe: Fix bug of checking input
FilePath

There is a simple bug in below code and will cause PXE always returning invalid 
parameter:

    if (FilePath == NULL || !IsDevicePathEnd (FilePath)) {
      return EFI_INVALID_PARAMETER;

FilePath should *not* be end node, so return invalid parameter when FilePath 
*is* device path end.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Heyi Guo <heyi....@linaro.org>
Cc: Feng Tian <feng.t...@intel.com>
Cc: Zhang Lubo <lubo.zh...@intel.com>
---
   MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
index 89977e6..1c7b664 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
@@ -2776,7 +2776,7 @@ EfiPxeLoadFile (
     UINT64                      TmpBufSize;
     BOOLEAN                     MediaPresent;
- if (FilePath == NULL || !IsDevicePathEnd (FilePath)) {
+  if (FilePath == NULL || IsDevicePathEnd (FilePath)) {
       return EFI_INVALID_PARAMETER;
     }
--
2.6.2

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to