This commit fixes bug which was causing one sector of bytes to be
ommited. It was discovered when bytes to be written was 0 in last block,
but total count of bytes was multiplication of sector size. It turned
out that in every case one sector of data was missing.

This bug can be fixed in various ways, but this solution fixes hypotetical
situation in which total bytes count is smaller than sector size.

Signed-off-by: Patryk Duda <p...@semihalf.com>
---
 Silicon/Marvell/Drivers/Spi/MvSpiFlashDxe/MvSpiFlashDxe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Silicon/Marvell/Drivers/Spi/MvSpiFlashDxe/MvSpiFlashDxe.c 
b/Silicon/Marvell/Drivers/Spi/MvSpiFlashDxe/MvSpiFlashDxe.c
index 02bc281c8b..db12adb764 100755
--- a/Silicon/Marvell/Drivers/Spi/MvSpiFlashDxe/MvSpiFlashDxe.c
+++ b/Silicon/Marvell/Drivers/Spi/MvSpiFlashDxe/MvSpiFlashDxe.c
@@ -388,7 +388,7 @@ MvSpiFlashUpdateWithProgress (
   UINT8 *TmpBuf;
 
   SectorSize = Slave->Info->SectorSize;
-  SectorNum = ByteCount / SectorSize;
+  SectorNum = (ByteCount / SectorSize) + 1;
   ToUpdate = SectorSize;
 
   TmpBuf = (UINT8 *)AllocateZeroPool (SectorSize);
-- 
2.21.0


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#47049): https://edk2.groups.io/g/devel/message/47049
Mute This Topic: https://groups.io/mt/34085584/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to