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
This commit is contained in:
Brooks Davis 2018-05-29 17:49:03 +00:00
parent c0fd148b5d
commit d8b2f0790b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=334342

View File

@ -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);