Date: Tue, 29 May 2018 20:03:24 +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: r334348 - in head/sys: amd64/linux amd64/linux32 i386/linux Message-ID: <201805292003.w4TK3OVv034464@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: brooks Date: Tue May 29 20:03:24 2018 New Revision: 334348 URL: https://svnweb.freebsd.org/changeset/base/334348 Log: Correct pointer subtraction in KASSERT(). The assertion would never fire without truly spectacular future programming errors. Reported by: Coverity CID: 1391370 Sponsored by: DARPA, AFRL Modified: head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/i386/linux/linux_sysvec.c Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Tue May 29 19:07:00 2018 (r334347) +++ head/sys/amd64/linux/linux_sysvec.c Tue May 29 20:03:24 2018 (r334348) @@ -283,8 +283,7 @@ linux_fixup_elf(register_t **stack_base, struct image_ AUXARGS_ENTRY(pos, AT_NULL, 0); free(imgp->auxargs, M_TEMP); imgp->auxargs = NULL; - KASSERT((pos - argarray) / sizeof(*pos) <= LINUX_AT_COUNT, - ("Too many auxargs")); + KASSERT(pos - argarray <= LINUX_AT_COUNT, ("Too many auxargs")); error = copyout(argarray, auxbase, sizeof(*argarray) * LINUX_AT_COUNT); free(argarray, M_TEMP); Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Tue May 29 19:07:00 2018 (r334347) +++ head/sys/amd64/linux32/linux32_sysvec.c Tue May 29 20:03:24 2018 (r334348) @@ -249,8 +249,7 @@ linux_fixup_elf(register_t **stack_base, struct image_ 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[0], auxbase, sizeof(*argarray) * AT_COUNT); free(argarray, M_TEMP); Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Tue May 29 19:07:00 2018 (r334347) +++ head/sys/i386/linux/linux_sysvec.c Tue May 29 20:03:24 2018 (r334348) @@ -261,8 +261,7 @@ linux_fixup_elf(register_t **stack_base, struct image_ free(imgp->auxargs, M_TEMP); imgp->auxargs = NULL; - KASSERT((pos - argarray) / sizeof(*pos) <= LINUX_AT_COUNT, - ("Too many auxargs")); + KASSERT(pos - argarray <= LINUX_AT_COUNT, ("Too many auxargs")); error = copyout(argarray, auxbase, sizeof(*argarray) * LINUX_AT_COUNT); free(argarray, M_TEMP);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805292003.w4TK3OVv034464>