Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 May 2018 17:49:03 +0000 (UTC)
From:      Brooks Davis <brooks@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r334342 - head/sys/kern
Message-ID:  <201805291749.w4THn3v5063350@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805291749.w4THn3v5063350>