Skip to content

Commit 70961e2

Browse files
wjablon1jhedberg
authored andcommitted
drivers: mm: Fix vm region range check
Checking virtual range is incorrect because size + 1 addresses are considered: size + starting address (that is also part of an allocation). Hence the last address of the range is impossible to map Signed-off-by: Wojciech Jablonski <wojciech.jablonski@intel.com>
1 parent 22fe768 commit 70961e2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/mm/mm_drv_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ int sys_mm_drv_map_region_safe(const struct sys_mm_drv_region *virtual_region,
3838

3939
/* check if memory to be mapped is within given virtual region */
4040
if ((POINTER_TO_UINT(virt) >= virtual_region_start) &&
41-
(POINTER_TO_UINT(virt) + size < virtual_region_end)) {
41+
(POINTER_TO_UINT(virt) + size <= virtual_region_end)) {
4242
return sys_mm_drv_map_region(virt, phys, size, flags);
4343
}
4444

0 commit comments

Comments
 (0)