Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

io: fix buffer overflow in metal_sys_io_mem_map() #324

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

iuliana-prodan
Copy link

In metal_sys_io_mem_map() if the I/O region size
is a multiple of (1<<page_shift) will result in a
buffer overflow in the for loop.

Therefore, adjust loop termination condition to
prevent accessing an out-of-bounds page.

Copy link
Contributor

@edmooring edmooring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the two compliance issues ("io->size -1" -> "io->size - 1"). Otherwise, this looks good to go.

In metal_sys_io_mem_map() if the I/O region size
is a multiple of (1<<page_shift) will result in a
buffer overflow in the for loop.

Therefore, adjust loop termination condition to
prevent accessing an out-of-bounds page.

Signed-off-by: Iuliana Prodan <[email protected]>
@iuliana-prodan
Copy link
Author

Please fix the two compliance issues ("io->size -1" -> "io->size - 1"). Otherwise, this looks good to go.

Done.
Thanks!

@arnopo arnopo linked an issue Feb 12, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

libmetal: Buffer overflow in metal_sys_io_mem_map()
4 participants