diff --git a/lib/libmemstat/memstat_malloc.c b/lib/libmemstat/memstat_malloc.c index b9b686f0777b..70320f5861d1 100644 --- a/lib/libmemstat/memstat_malloc.c +++ b/lib/libmemstat/memstat_malloc.c @@ -26,6 +26,7 @@ * $FreeBSD$ */ +#include #include #include #include @@ -253,14 +254,14 @@ kread(kvm_t *kvm, void *kvm_pointer, void *address, size_t size, } static int -kread_string(kvm_t *kvm, void *kvm_pointer, char *buffer, int buflen) +kread_string(kvm_t *kvm, const void *kvm_pointer, char *buffer, int buflen) { ssize_t ret; int i; for (i = 0; i < buflen; i++) { - ret = kvm_read(kvm, (unsigned long)kvm_pointer + i, - &(buffer[i]), sizeof(char)); + ret = kvm_read(kvm, __DECONST(unsigned long, kvm_pointer) + + i, &(buffer[i]), sizeof(char)); if (ret < 0) return (MEMSTAT_ERROR_KVM); if ((size_t)ret != sizeof(char))