git: c5345a05ce7d - stable/13 - ivrs_drv: Fix IVHDs with duplicated BaseAddress

Ka Ho Ng khng at FreeBSD.org
Wed Apr 7 10:56:04 UTC 2021


The branch stable/13 has been updated by khng:

URL: https://cgit.FreeBSD.org/src/commit/?id=c5345a05ce7dc86c422bdb707e817407ab52fa21

commit c5345a05ce7dc86c422bdb707e817407ab52fa21
Author:     Ka Ho Ng <khng at FreeBSD.org>
AuthorDate: 2021-03-22 09:33:43 +0000
Commit:     Ka Ho Ng <khng at FreeBSD.org>
CommitDate: 2021-04-07 10:55:38 +0000

    ivrs_drv: Fix IVHDs with duplicated BaseAddress
    
    Reviewed by:    jhb
    Approved by:    philip (mentor)
    MFC after:      2 weeks
    Differential Revision:  https://reviews.freebsd.org/D28945
    
    (cherry picked from commit ede14736fd6d74db0374f4a233491ad5dc0e9b1d)
---
 sys/amd64/vmm/amd/ivrs_drv.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys/amd64/vmm/amd/ivrs_drv.c b/sys/amd64/vmm/amd/ivrs_drv.c
index da3e0e17d140..d33229623a96 100644
--- a/sys/amd64/vmm/amd/ivrs_drv.c
+++ b/sys/amd64/vmm/amd/ivrs_drv.c
@@ -366,10 +366,11 @@ ivhd_identify(driver_t *driver, device_t parent)
 	for (i = ivhd_count - 1 ; i > 0 ; i--){
        		if (ivhd_is_newer(&ivhd_hdrs[i-1]->Header, 
 			&ivhd_hdrs[i]->Header)) {
-			ivhd_hdrs[i-1] = ivhd_hdrs[i];
+			memmove(&ivhd_hdrs[i-1], &ivhd_hdrs[i],
+			    sizeof(void *) * (ivhd_count - i));
 			ivhd_count--;
 		}
-       }	       
+	}
 
 	ivhd_devs = malloc(sizeof(device_t) * ivhd_count, M_DEVBUF,
 		M_WAITOK | M_ZERO);


More information about the dev-commits-src-all mailing list