Print this page
smatch clean rtld

@@ -68,11 +68,11 @@
                 return (NULL);
 
         /*
          * 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;
 
         ofl->ofl_flags = (FLG_OF_DYNAMIC | FLG_OF_SHAROBJ | FLG_OF_STRIP);

@@ -94,17 +94,15 @@
         /*
          * Obtain a generic set of entrance criteria, and generate a link map
          * 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;
 
         /*

@@ -274,11 +272,11 @@
             (hwcap2_check(scapset, omsk, &rej) == 0)) ||
             (((oalp = ofl->ofl_ocapset.oc_plat.cl_val) != NULL) &&
             (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]),
                             ofl->ofl_name, rej.rej_str);
                 }