mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-22 04:25:21 +00:00
pci: Fix end of address space check
The check performed on the end address was wrong since the end address was actually the address right after the end. To get the right end address, we need to add (region size - 1) to the start address. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
1971c94e4e
commit
927861ced2
@ -457,7 +457,7 @@ impl PciConfiguration {
|
|||||||
let bar_idx = BAR0_REG + config.reg_idx;
|
let bar_idx = BAR0_REG + config.reg_idx;
|
||||||
let end_addr = config
|
let end_addr = config
|
||||||
.addr
|
.addr
|
||||||
.checked_add(config.size)
|
.checked_add(config.size - 1)
|
||||||
.ok_or_else(|| Error::BarAddressInvalid(config.addr, config.size))?;
|
.ok_or_else(|| Error::BarAddressInvalid(config.addr, config.size))?;
|
||||||
match config.region_type {
|
match config.region_type {
|
||||||
PciBarRegionType::Memory32BitRegion | PciBarRegionType::IORegion => {
|
PciBarRegionType::Memory32BitRegion | PciBarRegionType::IORegion => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user