[arbel] Avoid potential integer overflow when calculating memory mappings
When the area to be mapped straddles the 2GB boundary, the expression (high+size) will overflow on the first loop iteration. Fix by using (end-size), which cannot underflow. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
parent
6ee62eb242
commit
a5affc832e
|
@ -1994,7 +1994,7 @@ static int arbel_map_vpm ( struct arbel *arbel,
|
|||
if ( ( low - size ) >= start ) {
|
||||
low -= size;
|
||||
pa = low;
|
||||
} else if ( ( high + size ) <= end ) {
|
||||
} else if ( high <= ( end - size ) ) {
|
||||
pa = high;
|
||||
high += size;
|
||||
} else {
|
||||
|
|
Reference in New Issue