[PATCH rtems6 - v2 07/16] flashdev: fix wrong offset assignment
Kinsey Moore
kinsey.moore at oarcorp.com
Tue Jan 9 23:01:38 UTC 2024
Typo in the commit message. I don't know this code very well so I'll leave
content review for someone else for now.
On Sun, Jan 7, 2024 at 12:19 PM <berndmoessner80 at gmail.com> wrote:
> 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.
>
"junk" should probably be "chunk"
>
> 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
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20240109/1fdefbe2/attachment-0001.htm>
More information about the devel
mailing list