return Status;\r
}\r
\r
+ //\r
+ // Simply reject device whose block size is unacceptable small (==0) or large (>64K).\r
+ //\r
+ if ((Media->BlockSize == 0) || (Media->BlockSize > USB_BOOT_MAX_CARRY_SIZE)) {\r
+ return EFI_DEVICE_ERROR;\r
+ }\r
+\r
//\r
// Detect whether it is necessary to reinstall the Block I/O Protocol.\r
//\r
UsbMass,\r
&Cmd,\r
(UINT8) sizeof (USB_BOOT_READ_WRITE_10_CMD),\r
- EfiUsbDataIn,\r
+ Write ? EfiUsbDataOut : EfiUsbDataIn,\r
Buffer,\r
ByteSize,\r
Timeout\r
UsbMass,\r
Cmd,\r
(UINT8) sizeof (Cmd),\r
- EfiUsbDataIn,\r
+ Write ? EfiUsbDataOut : EfiUsbDataIn,\r
Buffer,\r
ByteSize,\r
Timeout\r