[PATCH rtems6 - v2 07/16] flashdev: fix wrong offset assignment
berndmoessner80 at gmail.com
berndmoessner80 at gmail.com
Sun Jan 7 18:18:41 UTC 2024
From: Bernd Moessner <berndmoessner80 at gmail.com>
When the region feature is active, flashdev assumes that
a relative address is provided. It computes the abs. address and
carries out the read / write. However, in this case it must not
assign the abs. address to iop->offset. The relative address is
required here to allow newlib to correctly read/write the next
junk of data.
Updates #4981
---
cpukit/dev/flash/flashdev.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/cpukit/dev/flash/flashdev.c b/cpukit/dev/flash/flashdev.c
index 7bc13ed70a..b908e87023 100644
--- a/cpukit/dev/flash/flashdev.c
+++ b/cpukit/dev/flash/flashdev.c
@@ -145,8 +145,7 @@ static int rtems_flashdev_get_abs_addr(
static int rtems_flashdev_update_and_return(
rtems_libio_t *iop,
int status,
- size_t count,
- off_t new_offset
+ size_t count
);
static uint32_t rtems_flashdev_find_unallocated_region(
@@ -339,7 +338,7 @@ static int rtems_flashdev_read_write(
rtems_flashdev_release( flash );
/* Update offset and return */
- return rtems_flashdev_update_and_return( iop, status, count, addr + count );
+ return rtems_flashdev_update_and_return( iop, status, count );
}
static int rtems_flashdev_ioctl(
@@ -599,13 +598,12 @@ static int rtems_flashdev_get_abs_addr(
static int rtems_flashdev_update_and_return(
rtems_libio_t *iop,
int status,
- size_t count,
- off_t new_offset
+ size_t count
)
{
/* Update offset and return */
if ( status == 0 ) {
- iop->offset = new_offset;
+ iop->offset += count;
return count;
} else {
rtems_set_errno_and_return_minus_one( status );
--
2.34.1
More information about the devel
mailing list