Page MenuHomeFreeBSD

vmm: Fix wrong assert in ivhd_dev_add_entry
ClosedPublic

Authored by khng on Aug 12 2021, 6:58 AM.
Tags
None
Referenced Files
F107194280: D31514.diff
Sat, Jan 11, 11:44 AM
Unknown Object (File)
Dec 5 2024, 2:25 PM
Unknown Object (File)
Dec 5 2024, 12:33 AM
Unknown Object (File)
Dec 5 2024, 12:33 AM
Unknown Object (File)
Dec 5 2024, 12:32 AM
Unknown Object (File)
Dec 4 2024, 11:30 PM
Unknown Object (File)
Dec 3 2024, 10:03 PM
Unknown Object (File)
Nov 24 2024, 9:50 AM
Subscribers

Details

Summary

The correct condition is to check the number of ivhd entries fit into
the array.

Reported by: bz
Sponsored by: The FreeBSD Foundation

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 41009
Build 37898: arc lint + arc unit

Event Timeline

khng requested review of this revision.Aug 12 2021, 6:58 AM

I changed the text to this but swapping the < to > makes things boot! Thanks so much for your quick response!

diff --git sys/amd64/vmm/amd/ivrs_drv.c sys/amd64/vmm/amd/ivrs_drv.c
index 68c31788e29d..790b429bd1c8 100644
--- sys/amd64/vmm/amd/ivrs_drv.c
+++ sys/amd64/vmm/amd/ivrs_drv.c
@@ -184,8 +184,9 @@ ivhd_dev_add_entry(struct amdvi_softc *softc, uint32_t start_id,
 {
        struct ivhd_dev_cfg *dev_cfg;
 
-       KASSERT(softc->dev_cfg_cap <= softc->dev_cfg_cnt,
-           ("Impossible case: number of dev_cfg exceeding capacity"));
+       KASSERT(softc->dev_cfg_cap >= softc->dev_cfg_cnt, ("Impossible case: "
+           "dev_cfg exceeding capacity: dev_cfg_cap %d >= dev_cfg_cnt %d",
+           softc->dev_cfg_cap, softc->dev_cfg_cnt));
        if (softc->dev_cfg_cap == softc->dev_cfg_cnt) {
                if (softc->dev_cfg_cap == 0)
                        softc->dev_cfg_cap = 1;
This revision is now accepted and ready to land.Aug 12 2021, 7:49 AM
This revision was automatically updated to reflect the committed changes.