From d8b2f0790bd464d3659693715076bd4dbc784252 Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Tue, 29 May 2018 17:49:03 +0000 Subject: [PATCH] Correct pointer subtraction in KASSERT(). The assertion would never fire without truly spectacular future programming errors. Reported by: Coverity CID: 1391367, 1391368 Sponsored by: DARPA, AFRL --- sys/kern/imgact_elf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index 36217fc6e914..d5422a15900c 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -1145,8 +1145,7 @@ __elfN(freebsd_fixup)(register_t **stack_base, struct image_params *imgp) free(imgp->auxargs, M_TEMP); imgp->auxargs = NULL; - KASSERT((pos - argarray) / sizeof(*pos) <= AT_COUNT, - ("Too many auxargs")); + KASSERT(pos - argarray <= AT_COUNT, ("Too many auxargs")); error = copyout(argarray, auxbase, sizeof(*argarray) * AT_COUNT); free(argarray, M_TEMP);