File tree Expand file tree Collapse file tree 1 file changed +2
-11
lines changed
ArmPlatformPkg/Drivers/NorFlashDxe Expand file tree Collapse file tree 1 file changed +2
-11
lines changed Original file line number Diff line number Diff line change @@ -805,8 +805,7 @@ NorFlashRead (
805
805
OUT VOID * Buffer
806
806
)
807
807
{
808
- UINT32 NumBlocks ;
809
- UINTN StartAddress ;
808
+ UINTN StartAddress ;
810
809
811
810
// The buffer must be valid
812
811
if (Buffer == NULL ) {
@@ -818,15 +817,7 @@ NorFlashRead (
818
817
return EFI_SUCCESS ;
819
818
}
820
819
821
- // All blocks must be within the device
822
- NumBlocks = ((UINT32 )BufferSizeInBytes ) / Instance -> Media .BlockSize ;
823
-
824
- if ((Lba + NumBlocks ) > (Instance -> Media .LastBlock + 1 )) {
825
- DEBUG ((EFI_D_ERROR , "NorFlashRead: ERROR - Read will exceed last block\n" ));
826
- return EFI_INVALID_PARAMETER ;
827
- }
828
-
829
- if (Offset + BufferSizeInBytes >= Instance -> Size ) {
820
+ if (((Lba * Instance -> Media .BlockSize ) + Offset + BufferSizeInBytes ) > Instance -> Size ) {
830
821
DEBUG ((EFI_D_ERROR , "NorFlashRead: ERROR - Read will exceed device size.\n" ));
831
822
return EFI_INVALID_PARAMETER ;
832
823
}
You can’t perform that action at this time.
0 commit comments