Print this page
smatch clean rtld

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/sgs/rtld/common/object.c
          +++ new/usr/src/cmd/sgs/rtld/common/object.c
↓ open down ↓ 62 lines elided ↑ open up ↑
  63   63           * Allocate the name of this object, as the original name may be
  64   64           * associated with a data buffer that can be reused to load the
  65   65           * dependencies needed to processes this object.
  66   66           */
  67   67          if ((name = stravl_insert(oname, 0, 0, 0)) == NULL)
  68   68                  return (NULL);
  69   69  
  70   70          /*
  71   71           * Initialize an output file descriptor and the entrance criteria.
  72   72           */
  73      -        if ((ofl = calloc(sizeof (Ofl_desc), 1)) == NULL)
       73 +        if ((ofl = calloc(1, sizeof (Ofl_desc))) == NULL)
  74   74                  return (NULL);
  75   75  
  76   76          ofl->ofl_dehdr = &dehdr;
  77   77  
  78   78          ofl->ofl_flags = (FLG_OF_DYNAMIC | FLG_OF_SHAROBJ | FLG_OF_STRIP);
  79   79          ofl->ofl_flags1 = (FLG_OF1_RELDYN | FLG_OF1_TEXTOFF | FLG_OF1_MEMORY);
  80   80          ofl->ofl_lml = lml;
  81   81  
  82   82          /*
  83   83           * As ent_setup() will effectively lazy load the necessary support
↓ open down ↓ 5 lines elided ↑ open up ↑
  89   89          if ((elf_rtld_load() == 0) || (ld_init_target(lml, M_MACH) != 0)) {
  90   90                  free(ofl);
  91   91                  return (NULL);
  92   92          }
  93   93  
  94   94          /*
  95   95           * Obtain a generic set of entrance criteria, and generate a link map
  96   96           * place holder and use the ELFPRV() element to maintain the output
  97   97           * file descriptor.
  98   98           */
  99      -        lmsz = S_DROUND(sizeof (Rt_map)) + sizeof (Rt_elfp);
 100   99          if ((ld_ent_setup(ofl, syspagsz) == S_ERROR) ||
 101      -            ((olmp = calloc(lmsz, 1)) == NULL)) {
      100 +            ((olmp = calloc(1, sizeof (Rt_map))) == NULL)) {
 102  101                  free(ofl);
 103  102                  return (NULL);
 104  103          }
 105      -
 106  104          DBG_CALL(Dbg_file_elf(lml, name, 0, 0, lml->lm_lmidstr, lmco));
 107  105          FLAGS(olmp) |= FLG_RT_OBJECT;
 108  106          ELFPRV(olmp) = (void *)ofl;
 109  107  
 110  108          /*
 111  109           * Initialize string tables.
 112  110           */
 113  111          if (ld_init_strings(ofl) == S_ERROR) {
 114  112                  free(ofl);
 115  113                  free(olmp);
↓ open down ↓ 153 lines elided ↑ open up ↑
 269  267          if ((((omsk = ofl->ofl_ocapset.oc_hw_1.cm_val) != 0) &&
 270  268              (hwcap1_check(scapset, omsk, &rej) == 0)) ||
 271  269              (((omsk = ofl->ofl_ocapset.oc_sf_1.cm_val) != 0) &&
 272  270              (sfcap1_check(scapset, omsk, &rej) == 0)) ||
 273  271              (((omsk = ofl->ofl_ocapset.oc_hw_2.cm_val) != 0) &&
 274  272              (hwcap2_check(scapset, omsk, &rej) == 0)) ||
 275  273              (((oalp = ofl->ofl_ocapset.oc_plat.cl_val) != NULL) &&
 276  274              (check_plat_names(scapset, oalp, &rej) == 0)) ||
 277  275              (((oalp = ofl->ofl_ocapset.oc_mach.cl_val) != NULL) &&
 278  276              (check_mach_names(scapset, oalp, &rej) == 0))) {
 279      -                if ((lml_main.lm_flags & LML_FLG_TRC_LDDSTUB) && lmp &&
      277 +                if ((lml_main.lm_flags & LML_FLG_TRC_LDDSTUB) && 
 280  278                      (FLAGS1(lmp) & FL1_RT_LDDSTUB) && (NEXT(lmp) == NULL)) {
 281  279                          /* LINTED */
 282  280                          (void) printf(MSG_INTL(ldd_reject[rej.rej_type]),
 283  281                              ofl->ofl_name, rej.rej_str);
 284  282                  }
 285  283                  return (NULL);
 286  284          }
 287  285  
 288  286          /*
 289  287           * Finish creating the output file.
↓ open down ↓ 143 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX