Skip to content

Commit

Permalink
lib: chunkio: fixed file mapping size
Browse files Browse the repository at this point in the history
This bug had already been fixed in upstream, the round operation causes
the mapping size (and thus alloc size) to be larger than the file size
which means there is a memory area that's not backed by the file which
in some cases such as XFS causes data loss.

Signed-off-by: Leonardo Alminana <[email protected]>
  • Loading branch information
leonardo-albertovich authored and edsiper committed Sep 12, 2023
1 parent 6ad569e commit 4c7f71a
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion lib/chunkio/src/cio_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,6 @@ static int mmap_file(struct cio_ctx *ctx, struct cio_chunk *ch, size_t size)
}

/* Map the file */
size = ROUND_UP(size, ctx->page_size);
cf->map = mmap(0, size, oflags, MAP_SHARED, cf->fd, 0);
if (cf->map == MAP_FAILED) {
cio_errno();
Expand Down

0 comments on commit 4c7f71a

Please sign in to comment.