Print this page
smatch clean rtld

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/sgs/rtld/common/tls.c
          +++ new/usr/src/cmd/sgs/rtld/common/tls.c
↓ open down ↓ 267 lines elided ↑ open up ↑
 268  268           *      TLS_modinfo *   ptrs[tlsmodcnt + 1]
 269  269           *      TLS_modinfo     bufs[tlsmodcnt]
 270  270           *
 271  271           * The ptrs are initialized to the bufs - except the last one which
 272  272           * null terminates the array.
 273  273           *
 274  274           * Note, even if no TLS has yet been observed, we still supply a
 275  275           * TLS buffer with a single null entry.  This allows us to initialize
 276  276           * the backup TLS reservation.
 277  277           */
 278      -        if ((tlsmodlist = calloc((sizeof (TLS_modinfo *) * (tlsmodcnt + 1)) +
 279      -            (sizeof (TLS_modinfo) * tlsmodcnt), 1)) == NULL)
      278 +        if ((tlsmodlist = calloc(1, (sizeof (TLS_modinfo *) * (tlsmodcnt + 1)) +
      279 +            (sizeof (TLS_modinfo) * tlsmodcnt))) == NULL)
 280  280                  return (0);
 281  281  
 282  282          lml->lm_tls = 0;
 283  283  
 284  284          /*
 285  285           * If we don't have any TLS modules - report that and return.
 286  286           */
 287  287          if (tlsmodcnt == 0) {
 288  288                  if (fptr != NULL)
 289  289                          (void) (*fptr)(tlsmodlist, tls_static_resv);
↓ open down ↓ 51 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX