svn commit: r334342 - head/sys/kern

Brooks Davis brooks at FreeBSD.org
Tue May 29 17:49:04 UTC 2018


Author: brooks
Date: Tue May 29 17:49:03 2018
New Revision: 334342
URL: https://svnweb.freebsd.org/changeset/base/334342

Log:
  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

Modified:
  head/sys/kern/imgact_elf.c

Modified: head/sys/kern/imgact_elf.c
==============================================================================
--- head/sys/kern/imgact_elf.c	Tue May 29 17:44:40 2018	(r334341)
+++ head/sys/kern/imgact_elf.c	Tue May 29 17:49:03 2018	(r334342)
@@ -1145,8 +1145,7 @@ __elfN(freebsd_fixup)(register_t **stack_base, struct 
 
 	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);


More information about the svn-src-head mailing list