Print this page
10703 smatch unreachable code checking needs reworking
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/ucblib/libdbm/dbm.c
          +++ new/usr/src/ucblib/libdbm/dbm.c
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
  25   25  
  26   26  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  27      -/*        All Rights Reserved   */
       27 +/*        All Rights Reserved   */
  28   28  
  29   29  /*
  30   30   * Portions of this source code were derived from Berkeley 4.3 BSD
  31   31   * under license from the Regents of the University of California.
  32   32   */
  33   33  
  34   34  /*
  35      - * Copyright (c) 2018, Joyent, Inc.
       35 + * Copyright 2019 Joyent, Inc.
  36   36   */
  37   37  
  38   38  /*LINTLIBRARY*/
  39   39  
  40   40  #include        <sys/types.h>
  41   41  #include        <stdio.h>
  42   42  #include        <unistd.h>
  43   43  #include        <stdlib.h>
  44   44  #include        <strings.h>
  45   45  #include        <malloc.h>
↓ open down ↓ 188 lines elided ↑ open up ↑
 234  234                  item = makdatum(pagbuf, i);
 235  235                  Oneflag++;
 236  236                  if (item.dptr == NULL) {
 237  237                          if ((Sentry.dsize == key.dsize) &&
 238  238                              (strncmp(Sentry.dptr, key.dptr, key.dsize) == 0))
 239  239                                  return (-1);
 240  240                          if (Oneflag == 2) {
 241  241                                  Sentry.dsize = key.dsize;
 242  242                                  Sentry.dptr = malloc(strlen(key.dptr)+1);
 243  243                                  (void) strncpy(Sentry.dptr, key.dptr,
 244      -                                        key.dsize);
      244 +                                    key.dsize);
 245  245                          }
 246  246                          break;
 247  247                  }
 248  248                  if (calchash(item) & (hmask+1)) {
 249  249                          (void) additem(ovfbuf, item);
 250  250                          delitem(pagbuf, i);
 251  251                          item = makdatum(pagbuf, i);
 252  252                          if (item.dptr == NULL) {
 253  253                                  (void) printf("split not paired\n");
 254  254                                  break;
↓ open down ↓ 180 lines elided ↑ open up ↑
 435  435          n = d1.dsize;
 436  436          if (n != d2.dsize)
 437  437                  return (n - d2.dsize);
 438  438          if (n == 0)
 439  439                  return (0);
 440  440          p1 = d1.dptr;
 441  441          p2 = d2.dptr;
 442  442          do
 443  443                  if (*p1++ != *p2++)
 444  444                          return (*--p1 - *--p2);
 445      -        while (--n);
      445 +        while (--n)
      446 +                ;
 446  447          return (0);
 447  448  }
 448  449  
 449  450  int     hitab[16]
 450  451  /*
 451  452   * ken's
 452  453   * {
 453  454   *      055,043,036,054,063,014,004,005,
 454  455   *      010,064,077,000,035,027,025,071,
 455  456   * };
↓ open down ↓ 126 lines elided ↑ open up ↑
 582  583                          goto bad;
 583  584                  t = sp[i+1];
 584  585          }
 585  586          if (t < (sp[0]+1)*sizeof (short))
 586  587                  goto bad;
 587  588          return;
 588  589  
 589  590  bad:
 590  591          (void) printf("bad block\n");
 591  592          abort();
 592      -        bzero(buf, PBLKSIZ);
 593  593  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX