Print this page
smatch clean rtld

@@ -394,11 +394,11 @@
         }
 
         /*
          * 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;
         fpnp->fpn_node.pn_hash = hash;
         fpnp->fpn_lmp = lmp;

@@ -457,11 +457,11 @@
         }
 
         /*
          * 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);
         }
 }

@@ -504,11 +504,11 @@
                 return;
 
         /*
          * 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);
         }
 }

@@ -2886,11 +2886,11 @@
 {
         int             overflow = 0;
         static int      lock = 0;
         Prfbuf          prf;
 
-        if (lock || (nextptr == (errbuf + ERRSIZE)))
+        if (lock || (nextptr > (errbuf + (ERRSIZE - 1))))
                 return;
 
         /*
          * Note: this lock is here to prevent the same thread from recursively
          * entering itself during a eprintf.  ie: during eprintf malloc() fails

@@ -3124,11 +3124,11 @@
                                             MSG_STR_NL_SIZE);
                                         errptr += (size + 1);
                                 }
                         }
                         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);
                         }
                 }