Skip to content

Commit 25aa0e6

Browse files
authored
Merge pull request #5846 from geky/fix-block-addr-overflow
littlefs: Fix block addr overflow
2 parents 728f76d + 44e2ca4 commit 25aa0e6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

features/filesystem/littlefs/LittleFileSystem.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,19 @@ static int lfs_totype(int type)
8585
static int lfs_bd_read(const struct lfs_config *c, lfs_block_t block,
8686
lfs_off_t off, void *buffer, lfs_size_t size) {
8787
BlockDevice *bd = (BlockDevice *)c->context;
88-
return bd->read(buffer, block*c->block_size + off, size);
88+
return bd->read(buffer, (bd_addr_t)block*c->block_size + off, size);
8989
}
9090

9191
static int lfs_bd_prog(const struct lfs_config *c, lfs_block_t block,
9292
lfs_off_t off, const void *buffer, lfs_size_t size) {
9393
BlockDevice *bd = (BlockDevice *)c->context;
94-
return bd->program(buffer, block*c->block_size + off, size);
94+
return bd->program(buffer, (bd_addr_t)block*c->block_size + off, size);
9595
}
9696

9797
static int lfs_bd_erase(const struct lfs_config *c, lfs_block_t block)
9898
{
9999
BlockDevice *bd = (BlockDevice *)c->context;
100-
return bd->erase(block*c->block_size, c->block_size);
100+
return bd->erase((bd_addr_t)block*c->block_size, c->block_size);
101101
}
102102

103103
static int lfs_bd_sync(const struct lfs_config *c)

0 commit comments

Comments
 (0)