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 <pdk@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/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
On Mon, Sep 09, 2019 at 05:52:11PM +0200, Patryk Duda wrote: > 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 <pdk@semihalf.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org> Pushed as 6e58a613d9aa. Thanks! > --- > 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 (#48246): https://edk2.groups.io/g/devel/message/48246 Mute This Topic: https://groups.io/mt/34085584/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2024 Red Hat, Inc.