]> mj.ucw.cz Git - pciutils.git/commit
libpci: physmem-windows: Fix check for length param of physmem_unmap()
authorPali Rohár <pali@kernel.org>
Sun, 30 Nov 2025 16:21:57 +0000 (17:21 +0100)
committerMartin Mareš <mj@ucw.cz>
Sun, 28 Dec 2025 20:49:06 +0000 (21:49 +0100)
commit0fcdc104a8efdef8699b44251392cdf7fe0862ca
tree703ae0a68f9cff079d27a94ff301d85ff456f919
parentc92498ba163553a3f56fcbfc7f84573b597431d4
libpci: physmem-windows: Fix check for length param of physmem_unmap()

VirtualQuery() does not have to return whole mapped range, but just region
subset. So call VirtualQuery() multiple times for each region and calculate
the total length of the mapping.

This change fixes unmapping of the BIOS 0xE0000-0x100000 memory for which
Windows creates region of one page and so VirtualQuery() for each region i
at virtual address ptr + i*4096 returns AllocationBase=ptr and RegionSize=4096.
lib/physmem-windows.c