Skip to content

Commit

Permalink
drivers/mtd/bch: fix size_t overflow when offset > 4GB
Browse files Browse the repository at this point in the history
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
  • Loading branch information
Donny9 committed Sep 8, 2024
1 parent 9d5b9b7 commit 9594081
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion drivers/bch/bchlib_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
*
****************************************************************************/

ssize_t bchlib_read(FAR void *handle, FAR char *buffer, size_t offset,
ssize_t bchlib_read(FAR void *handle, FAR char *buffer, off_t offset,
size_t len)
{
FAR struct bchlib_s *bch = (FAR struct bchlib_s *)handle;
Expand Down
2 changes: 1 addition & 1 deletion drivers/bch/bchlib_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
*
****************************************************************************/

ssize_t bchlib_write(FAR void *handle, FAR const char *buffer, size_t offset,
ssize_t bchlib_write(FAR void *handle, FAR const char *buffer, off_t offset,
size_t len)
{
FAR struct bchlib_s *bch = (FAR struct bchlib_s *)handle;
Expand Down
2 changes: 1 addition & 1 deletion drivers/mtd/filemtd.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ static int mtd_loop_ioctl(FAR struct file *filep, int cmd,
*
****************************************************************************/

FAR struct mtd_dev_s *filemtd_initialize(FAR const char *path, size_t offset,
FAR struct mtd_dev_s *filemtd_initialize(FAR const char *path, off_t offset,
int16_t sectsize, int32_t erasesize)
{
FAR struct file_dev_s *priv;
Expand Down
4 changes: 2 additions & 2 deletions include/nuttx/drivers/drivers.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ int bchlib_teardown(FAR void *handle);
*
****************************************************************************/

ssize_t bchlib_read(FAR void *handle, FAR char *buffer, size_t offset,
ssize_t bchlib_read(FAR void *handle, FAR char *buffer, off_t offset,
size_t len);

/****************************************************************************
Expand All @@ -243,7 +243,7 @@ ssize_t bchlib_read(FAR void *handle, FAR char *buffer, size_t offset,
*
****************************************************************************/

ssize_t bchlib_write(FAR void *handle, FAR const char *buffer, size_t offset,
ssize_t bchlib_write(FAR void *handle, FAR const char *buffer, off_t offset,
size_t len);

/****************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion include/nuttx/mtd/mtd.h
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ FAR struct mtd_dev_s *w25qxxxjv_initialize(FAR struct qspi_dev_s *qspi,
*
****************************************************************************/

FAR struct mtd_dev_s *filemtd_initialize(FAR const char *path, size_t offset,
FAR struct mtd_dev_s *filemtd_initialize(FAR const char *path, off_t offset,
int16_t sectsize,
int32_t erasesize);

Expand Down

0 comments on commit 9594081

Please sign in to comment.