Closed tammyleino closed 1 year ago
PR https://github.com/OpenAMP/open-amp/pull/406 is dependent on this PR.
This looks good to me. There may be a case where a false positive can happen (addr + len overflows), but that shouldn't stop this improvement from going in.
@edmooring Thank you very much for your eyes on this. Can you please provide an example of the overflow so I am clear?
@tammyleino For the overflow, consider the following on a 32-bit architecture: io->virt = 0xffffff00 io->size = 0x80 addr = 0xffffff08 len = 0x100 Unless I have missed something, addr + len will overflow to 0x8 which will pass the test of (addr + len < io->virt + io->size) but still access memory that it shouldn't.
Ensures the specified address falls within the valid range of the io block Signed-off-by: Tammy Leino tammy_leino@mentor.com