--- old/usr/src/cmd/sgs/rtld/amd64/amd64_elf.c	2019-03-04 02:11:14.216183921 +0000
+++ new/usr/src/cmd/sgs/rtld/amd64/amd64_elf.c	2019-03-04 02:11:14.232924197 +0000
@@ -237,12 +237,10 @@
 	}
 
 	/*
-	 * Perform some basic sanity checks.  If we didn't get a load map or
-	 * the relocation offset is invalid then its possible someone has walked
-	 * over the .got entries or jumped to plt0 out of the blue.
+	 * Perform some basic sanity checks.  If the relocation offset is
+	 * invalid then its possible someone has walked over the .got entries.
 	 */
-	if ((!lmp) && (pltndx <=
-	    (ulong_t)PLTRELSZ(lmp) / (ulong_t)RELENT(lmp))) {
+	if (pltndx > (ulong_t)PLTRELSZ(lmp) / (ulong_t)RELENT(lmp)) {
 		Conv_inv_buf_t inv_buf;
 
 		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_PLTREF),
--- old/usr/src/cmd/sgs/rtld/common/analyze.c	2019-03-04 02:11:14.698160796 +0000
+++ new/usr/src/cmd/sgs/rtld/common/analyze.c	2019-03-04 02:11:14.714503172 +0000
@@ -1543,7 +1543,7 @@
 	if ((olen + pdp->pd_plen + 1) >= PATH_MAX) {
 		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), oname,
 		    strerror(ENAMETOOLONG));
-			return (0);
+		return (0);
 	}
 	if ((fdp->fd_nname = (LM_GET_SO(clmp)(pdp->pd_pname, oname,
 	    pdp->pd_plen, olen))) == NULL)
--- old/usr/src/cmd/sgs/rtld/common/audit.c	2019-03-04 02:11:15.229758810 +0000
+++ new/usr/src/cmd/sgs/rtld/common/audit.c	2019-03-04 02:11:15.243452273 +0000
@@ -719,7 +719,7 @@
 		DBG_CALL(Dbg_audit_objclose(lml, alp->al_libname, NAME(lmp)));
 
 		leave(alml, thr_flg_reenter);
-		(*alp->al_objclose)(&(acp->ac_cookie));
+		(void) (*alp->al_objclose)(&(acp->ac_cookie));
 		(void) enter(thr_flg_reenter);
 	}
 }
--- old/usr/src/cmd/sgs/rtld/common/cap.c	2019-03-04 02:11:15.687263106 +0000
+++ new/usr/src/cmd/sgs/rtld/common/cap.c	2019-03-04 02:11:15.701500455 +0000
@@ -1009,7 +1009,7 @@
 		if (pnavl_recorded(&capavl, name, hash, &where))
 			continue;
 
-		if ((pnp = calloc(sizeof (PathNode), 1)) != NULL) {
+		if ((pnp = calloc(1, sizeof (PathNode))) != NULL) {
 			pnp->pn_name = name;
 			pnp->pn_hash = hash;
 			avl_insert(capavl, pnp, where);
--- old/usr/src/cmd/sgs/rtld/common/dlfcns.c	2019-03-04 02:11:16.150327054 +0000
+++ new/usr/src/cmd/sgs/rtld/common/dlfcns.c	2019-03-04 02:11:16.165944874 +0000
@@ -869,7 +869,7 @@
 	 *  LM_ID_NEWLM: 	Create a new link-map.
 	 */
 	if (lml == (Lm_list *)LM_ID_NEWLM) {
-		if ((lml = calloc(sizeof (Lm_list), 1)) == NULL)
+		if ((lml = calloc(1, sizeof (Lm_list))) == NULL)
 			return (NULL);
 
 		/*
--- old/usr/src/cmd/sgs/rtld/common/elf.c	2019-03-04 02:11:16.674311788 +0000
+++ new/usr/src/cmd/sgs/rtld/common/elf.c	2019-03-04 02:11:16.689285730 +0000
@@ -1720,7 +1720,7 @@
 	rtsz = S_DROUND(sizeof (Rt_map));
 	epsz = S_DROUND(sizeof (Rt_elfp));
 	lmsz = rtsz + epsz + dynsz;
-	if ((lmp = calloc(lmsz, 1)) == NULL)
+	if ((lmp = calloc(1, lmsz)) == NULL)
 		return (NULL);
 	ELFPRV(lmp) = (void *)((uintptr_t)lmp + rtsz);
 	DYNINFO(lmp) = (Dyninfo *)((uintptr_t)lmp + rtsz + epsz);
@@ -2355,7 +2355,7 @@
 	if (CAPCHAIN(lmp)) {
 		Capchain	*capchain;
 
-		if ((capchain = calloc(CAPCHAINSZ(lmp), 1)) == NULL)
+		if ((capchain = calloc(1, CAPCHAINSZ(lmp))) == NULL)
 			return (NULL);
 		(void) memcpy(capchain, CAPCHAIN(lmp), CAPCHAINSZ(lmp));
 		CAPCHAIN(lmp) = capchain;
--- old/usr/src/cmd/sgs/rtld/common/locale.c	2019-03-04 02:11:17.206893203 +0000
+++ new/usr/src/cmd/sgs/rtld/common/locale.c	2019-03-04 02:11:17.220497505 +0000
@@ -228,7 +228,7 @@
 	 * Determine if we've initialized any domains yet.
 	 */
 	if (domaincnt == 0) {
-		if ((domains = calloc(sizeof (Domain), 2)) == NULL)
+		if ((domains = calloc(2, sizeof (Domain))) == NULL)
 			return ((char *)msgid);
 		domains[0].dom_name = MSG_ORIG(MSG_SUNW_OST_SGS);
 		domains[1].dom_name = MSG_ORIG(MSG_SUNW_OST_OSLIB);
--- old/usr/src/cmd/sgs/rtld/common/object.c	2019-03-04 02:11:17.618788859 +0000
+++ new/usr/src/cmd/sgs/rtld/common/object.c	2019-03-04 02:11:17.635933389 +0000
@@ -70,7 +70,7 @@
 	/*
 	 * Initialize an output file descriptor and the entrance criteria.
 	 */
-	if ((ofl = calloc(sizeof (Ofl_desc), 1)) == NULL)
+	if ((ofl = calloc(1, sizeof (Ofl_desc))) == NULL)
 		return (NULL);
 
 	ofl->ofl_dehdr = &dehdr;
@@ -96,13 +96,11 @@
 	 * place holder and use the ELFPRV() element to maintain the output
 	 * file descriptor.
 	 */
-	lmsz = S_DROUND(sizeof (Rt_map)) + sizeof (Rt_elfp);
 	if ((ld_ent_setup(ofl, syspagsz) == S_ERROR) ||
-	    ((olmp = calloc(lmsz, 1)) == NULL)) {
+	    ((olmp = calloc(1, sizeof (Rt_map))) == NULL)) {
 		free(ofl);
 		return (NULL);
 	}
-
 	DBG_CALL(Dbg_file_elf(lml, name, 0, 0, lml->lm_lmidstr, lmco));
 	FLAGS(olmp) |= FLG_RT_OBJECT;
 	ELFPRV(olmp) = (void *)ofl;
@@ -276,7 +274,7 @@
 	    (check_plat_names(scapset, oalp, &rej) == 0)) ||
 	    (((oalp = ofl->ofl_ocapset.oc_mach.cl_val) != NULL) &&
 	    (check_mach_names(scapset, oalp, &rej) == 0))) {
-		if ((lml_main.lm_flags & LML_FLG_TRC_LDDSTUB) && lmp &&
+		if ((lml_main.lm_flags & LML_FLG_TRC_LDDSTUB) && 
 		    (FLAGS1(lmp) & FL1_RT_LDDSTUB) && (NEXT(lmp) == NULL)) {
 			/* LINTED */
 			(void) printf(MSG_INTL(ldd_reject[rej.rej_type]),
--- old/usr/src/cmd/sgs/rtld/common/tls.c	2019-03-04 02:11:18.024716999 +0000
+++ new/usr/src/cmd/sgs/rtld/common/tls.c	2019-03-04 02:11:18.038041931 +0000
@@ -275,8 +275,8 @@
 	 * TLS buffer with a single null entry.  This allows us to initialize
 	 * the backup TLS reservation.
 	 */
-	if ((tlsmodlist = calloc((sizeof (TLS_modinfo *) * (tlsmodcnt + 1)) +
-	    (sizeof (TLS_modinfo) * tlsmodcnt), 1)) == NULL)
+	if ((tlsmodlist = calloc(1, (sizeof (TLS_modinfo *) * (tlsmodcnt + 1)) +
+	    (sizeof (TLS_modinfo) * tlsmodcnt))) == NULL)
 		return (0);
 
 	lml->lm_tls = 0;
--- old/usr/src/cmd/sgs/rtld/common/util.c	2019-03-04 02:11:18.455955245 +0000
+++ new/usr/src/cmd/sgs/rtld/common/util.c	2019-03-04 02:11:18.470026585 +0000
@@ -396,7 +396,7 @@
 	/*
 	 * Insert new node in tree.
 	 */
-	if ((fpnp = calloc(sizeof (FullPathNode), 1)) == NULL)
+	if ((fpnp = calloc(1, sizeof (FullPathNode))) == NULL)
 		return (0);
 
 	fpnp->fpn_node.pn_name = name;
@@ -459,7 +459,7 @@
 	/*
 	 * Insert new node in tree.
 	 */
-	if ((pnp = calloc(sizeof (PathNode), 1)) != NULL) {
+	if ((pnp = calloc(1, sizeof (PathNode))) != NULL) {
 		pnp->pn_name = name;
 		pnp->pn_hash = hash;
 		avl_insert(nfavl, pnp, where);
@@ -506,7 +506,7 @@
 	/*
 	 * Insert new node in tree.
 	 */
-	if ((pnp = calloc(sizeof (PathNode), 1)) != NULL) {
+	if ((pnp = calloc(1, sizeof (PathNode))) != NULL) {
 		pnp->pn_name = strdup(buffer);
 		pnp->pn_hash = hash;
 		avl_insert(spavl, pnp, where);
@@ -2888,7 +2888,7 @@
 	static int	lock = 0;
 	Prfbuf		prf;
 
-	if (lock || (nextptr == (errbuf + ERRSIZE)))
+	if (lock || (nextptr > (errbuf + (ERRSIZE - 1))))
 		return;
 
 	/*
@@ -3126,7 +3126,7 @@
 				}
 			}
 			if (lasterr && ((lasterr < errbuf) ||
-			    (lasterr > (errbuf + ERRSIZE)))) {
+			    (lasterr > (errbuf + (ERRSIZE - 1))))) {
 				(void) write(2, lasterr, strlen(lasterr));
 				(void) write(2, MSG_ORIG(MSG_STR_NL),
 				    MSG_STR_NL_SIZE);
--- old/usr/src/cmd/sgs/rtld/i386/i386_elf.c	2019-03-04 02:11:19.054453655 +0000
+++ new/usr/src/cmd/sgs/rtld/i386/i386_elf.c	2019-03-04 02:11:19.070775885 +0000
@@ -222,7 +222,7 @@
 	 * the relocation offset is invalid then its possible someone has walked
 	 * over the .got entries or jumped to plt0 out of the blue.
 	 */
-	if (!lmp || ((reloff % sizeof (Rel)) != 0)) {
+	if ((reloff % sizeof (Rel)) != 0) {
 		Conv_inv_buf_t inv_buf;
 
 		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_PLTREF),
