mirror of
https://github.com/ipxe/ipxe
synced 2025-12-23 13:30:57 +03:00
[hermon] 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:
@@ -2135,7 +2135,7 @@ static int hermon_map_vpm ( struct hermon *hermon,
|
||||
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
Block a user