mirror of
https://github.com/apache/nuttx.git
synced 2026-09-27 18:58:27 +08:00
More NXFFS bugfixes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3560 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -127,13 +127,6 @@ static int ram_erase(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblocks
|
||||
|
||||
DEBUGASSERT(dev);
|
||||
|
||||
/* Convert the erase block to a logical block and the number of blocks
|
||||
* in logical block numbers
|
||||
*/
|
||||
|
||||
startblock *= CONFIG_RAMMTD_BLKPER;
|
||||
nblocks *= CONFIG_RAMMTD_BLKPER;
|
||||
|
||||
/* Don't let the erase exceed the size of the ram buffer */
|
||||
|
||||
if (startblock >= priv->nblocks)
|
||||
@@ -141,11 +134,18 @@ static int ram_erase(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblocks
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (startblock + nblocks >= priv->nblocks)
|
||||
if (startblock + nblocks > priv->nblocks)
|
||||
{
|
||||
nblocks = priv->nblocks - nblocks;
|
||||
nblocks = priv->nblocks - startblock;
|
||||
}
|
||||
|
||||
/* Convert the erase block to a logical block and the number of blocks
|
||||
* in logical block numbers
|
||||
*/
|
||||
|
||||
startblock *= CONFIG_RAMMTD_BLKPER;
|
||||
nblocks *= CONFIG_RAMMTD_BLKPER;
|
||||
|
||||
/* Get the offset corresponding to the first block and the size
|
||||
* corresponding to the number of blocks.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user