From d4a54b5487e548827cb743986a2a4b4e060470ca Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Sun, 31 Jul 2016 00:26:13 +0200 Subject: [PATCH] [Horus] Massstorage bugfix (read cache beyond end of disk) --- radio/src/disk_cache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/src/disk_cache.cpp b/radio/src/disk_cache.cpp index 53bcdb858..b6a6ce79b 100644 --- a/radio/src/disk_cache.cpp +++ b/radio/src/disk_cache.cpp @@ -102,7 +102,7 @@ DRESULT DiskCache::read(BYTE drv, BYTE * buff, DWORD sector, UINT count) } // if block + cache block size is beyond the end of the disk, then read it directly without using cache - if (sector+DISK_CACHE_BLOCK_SECTORS > SDCardInfo.CardCapacity / SDCardInfo.CardBlockSize) { + if (sector+DISK_CACHE_BLOCK_SECTORS >= SDCardInfo.CardCapacity / SDCardInfo.CardBlockSize) { TRACE_DISK_CACHE("\t\t cache would be beyond end of disk(%u)", this, (uint32_t)sector); return __disk_read(drv, buff, sector, count); }