opnsense-src/sys/x86
Dimitry Andric 7756b8f25e xen: Fix warning by adding KERNBASE to modlist_paddr before casting
Clang 13 produces the following warning for hammer_time_xen():

sys/x86/xen/pv.c:183:19: error: the pointer incremented by -2147483648 refers past the last possible element for an array in 64-bit address space containing 256-bit (32-byte) elements (max possible 576460752303423488 elements) [-Werror,-Warray-bounds]
                    (vm_paddr_t)start_info->modlist_paddr + KERNBASE;
                                ^                               ~~~~~~~~
sys/xen/interface/arch-x86/hvm/start_info.h:131:5: note: array 'modlist_paddr' declared here
    uint64_t modlist_paddr;         /* Physical address of an array of           */
    ^

This is because the expression first casts start_info->modlist_paddr to
struct hvm_modlist_entry * (via vmpaddr_t), and *then* adds KERNBASE,
which is then interpreted as KERNBASE * sizeof(struct
hvm_modlist_entry).

Instead, parenthesize the addition to get the intended result, and cast
it to struct hvm_modlist_entry * afterwards. Also remove the cast to
vmpaddr_t since it is not necessary.

Reviewed by:	royger
Differential Revision: https://reviews.freebsd.org/D31711

(cherry picked from commit 8e3c56d6b6)
2021-09-02 23:53:18 +02:00
..
acpica Disable x2APIC for SandyBridge laptops with Samsung BIOS 2021-06-10 03:47:50 +03:00
bios Explicit CTLFLAG_DYN not needed 2020-10-04 19:37:15 +00:00
conf Use envvar rather than nonstandard hint. lines 2020-09-23 19:18:53 +00:00
cpufreq hwpstate_intel: don't unconditionally print the error message 2020-11-29 01:43:04 +00:00
include amd64: stop doing special allocation for the AP startup trampoline 2021-08-24 02:21:13 +03:00
iommu dmar: reserve memory windows of PCIe root port 2020-12-09 18:43:58 +00:00
isa Remove more remnants of sio(4) 2021-04-14 09:19:49 -04:00
linux linux(4): Deduplicate unimpl/dummy syscall handlers 2020-11-05 19:30:31 +00:00
pci x86: clean up empty lines in .c and .h files 2020-09-01 21:23:59 +00:00
x86 amd64: stop doing special allocation for the AP startup trampoline 2021-08-24 02:21:13 +03:00
xen xen: Fix warning by adding KERNBASE to modlist_paddr before casting 2021-09-02 23:53:18 +02:00