Print this page
smatch clean rtld

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/sgs/rtld/common/elf.c
          +++ new/usr/src/cmd/sgs/rtld/common/elf.c
↓ open down ↓ 1712 lines elided ↑ open up ↑
1713 1713  
1714 1714          /*
1715 1715           * Allocate space for the link-map, private elf information, and
1716 1716           * DYNINFO() data.  Once these are allocated and initialized,
1717 1717           * remove_so(0, lmp) can be used to tear down the link-map allocation
1718 1718           * should any failures occur.
1719 1719           */
1720 1720          rtsz = S_DROUND(sizeof (Rt_map));
1721 1721          epsz = S_DROUND(sizeof (Rt_elfp));
1722 1722          lmsz = rtsz + epsz + dynsz;
1723      -        if ((lmp = calloc(lmsz, 1)) == NULL)
     1723 +        if ((lmp = calloc(1, lmsz)) == NULL)
1724 1724                  return (NULL);
1725 1725          ELFPRV(lmp) = (void *)((uintptr_t)lmp + rtsz);
1726 1726          DYNINFO(lmp) = (Dyninfo *)((uintptr_t)lmp + rtsz + epsz);
1727 1727          LMSIZE(lmp) = lmsz;
1728 1728  
1729 1729          /*
1730 1730           * All fields not filled in were set to 0 by calloc.
1731 1731           */
1732 1732          NAME(lmp) = (char *)name;
1733 1733          ADDR(lmp) = addr;
↓ open down ↓ 614 lines elided ↑ open up ↑
2348 2348           * If a capabilities chain table exists, duplicate it.  The chain table
2349 2349           * is inspected for each initial call to a capabilities family lead
2350 2350           * symbol.  From this chain, each family member is inspected to
2351 2351           * determine the 'best' family member.  The chain table is then updated
2352 2352           * so that the best member is immediately selected for any further
2353 2353           * family searches.
2354 2354           */
2355 2355          if (CAPCHAIN(lmp)) {
2356 2356                  Capchain        *capchain;
2357 2357  
2358      -                if ((capchain = calloc(CAPCHAINSZ(lmp), 1)) == NULL)
     2358 +                if ((capchain = calloc(1, CAPCHAINSZ(lmp))) == NULL)
2359 2359                          return (NULL);
2360 2360                  (void) memcpy(capchain, CAPCHAIN(lmp), CAPCHAINSZ(lmp));
2361 2361                  CAPCHAIN(lmp) = capchain;
2362 2362          }
2363 2363  
2364 2364          /*
2365 2365           * Add the mapped object to the end of the link map list.
2366 2366           */
2367 2367          lm_append(lml, lmco, lmp);
2368 2368  
↓ open down ↓ 647 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX