aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2021-04-29 15:39:02 +0000
committerMark Johnston <markj@FreeBSD.org>2021-04-29 15:39:02 +0000
commit20e3b9d8bd778445bb80b2be28d2fdedf7bae37e (patch)
tree4a8009623ede4c10800cad83b709ff9e0db52f4f
parentee8b757a949a9575c7355ea01f0475e0c526b9e5 (diff)
downloadsrc-20e3b9d8bd778445bb80b2be28d2fdedf7bae37e.tar.gz
src-20e3b9d8bd778445bb80b2be28d2fdedf7bae37e.zip
kasan: Use vm_offset_t for the first parameter to kasan_shadow_map()
No functional change intended. Sponsored by: The FreeBSD Foundation
-rw-r--r--sys/amd64/amd64/pmap.c2
-rw-r--r--sys/kern/subr_asan.c10
-rw-r--r--sys/sys/asan.h2
3 files changed, 7 insertions, 7 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 77c486c0d00a..66617bffa8df 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -4890,7 +4890,7 @@ pmap_growkernel(vm_offset_t addr)
if (addr - 1 >= vm_map_max(kernel_map))
addr = vm_map_max(kernel_map);
if (kernel_vm_end < addr)
- kasan_shadow_map((void *)kernel_vm_end, addr - kernel_vm_end);
+ kasan_shadow_map(kernel_vm_end, addr - kernel_vm_end);
while (kernel_vm_end < addr) {
pdpe = pmap_pdpe(kernel_pmap, kernel_vm_end);
if ((*pdpe & X86_PG_V) == 0) {
diff --git a/sys/kern/subr_asan.c b/sys/kern/subr_asan.c
index d0478899e8c7..b812f7bca465 100644
--- a/sys/kern/subr_asan.c
+++ b/sys/kern/subr_asan.c
@@ -97,18 +97,18 @@ static bool kasan_enabled __read_mostly = false;
/* -------------------------------------------------------------------------- */
void
-kasan_shadow_map(void *addr, size_t size)
+kasan_shadow_map(vm_offset_t addr, size_t size)
{
size_t sz, npages, i;
vm_offset_t sva, eva;
- KASSERT((vm_offset_t)addr % KASAN_SHADOW_SCALE == 0,
- ("%s: invalid address %p", __func__, addr));
+ KASSERT(addr % KASAN_SHADOW_SCALE == 0,
+ ("%s: invalid address %#lx", __func__, addr));
sz = roundup(size, KASAN_SHADOW_SCALE) / KASAN_SHADOW_SCALE;
- sva = kasan_md_addr_to_shad((vm_offset_t)addr);
- eva = kasan_md_addr_to_shad((vm_offset_t)addr) + sz;
+ sva = kasan_md_addr_to_shad(addr);
+ eva = kasan_md_addr_to_shad(addr) + sz;
sva = rounddown(sva, PAGE_SIZE);
eva = roundup(eva, PAGE_SIZE);
diff --git a/sys/sys/asan.h b/sys/sys/asan.h
index c86202222c72..caa6643bda68 100644
--- a/sys/sys/asan.h
+++ b/sys/sys/asan.h
@@ -56,7 +56,7 @@
#define KASAN_EXEC_ARGS_FREED 0xFF
void kasan_init(void);
-void kasan_shadow_map(void *, size_t);
+void kasan_shadow_map(vm_offset_t, size_t);
void kasan_mark(const void *, size_t, size_t, uint8_t);
#else /* KASAN */