mirror of https://github.com/ipxe/ipxe.git
[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>pull/58/merge
parent
de2c6fa240
commit
6ee62eb242
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue