Print this page
10096 kstat update routines shouldn't check for NULL kstat

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/inet/sctp/sctp_snmp.c
          +++ new/usr/src/uts/common/inet/sctp/sctp_snmp.c
↓ open down ↓ 15 lines elided ↑ open up ↑
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
  24   24   */
  25   25  
       26 +/*
       27 + * Copyright (c) 2018, Joyent, Inc.
       28 + */
       29 +
  26   30  #include <sys/types.h>
  27   31  #include <sys/stream.h>
  28   32  #include <sys/cmn_err.h>
  29   33  #define _SUN_TPI_VERSION 2
  30   34  #include <sys/tihdr.h>
  31   35  #include <sys/ddi.h>
  32   36  #include <sys/sunddi.h>
  33   37  #include <sys/tsol/tndb.h>
  34   38  
  35   39  #include <netinet/in.h>
↓ open down ↓ 17 lines elided ↑ open up ↑
  53   57  sctp_kstat_update(kstat_t *kp, int rw)
  54   58  {
  55   59          sctp_named_kstat_t      *sctpkp;
  56   60          sctp_t                  *sctp, *sctp_prev;
  57   61          zoneid_t        myzoneid;
  58   62          netstackid_t    stackid = (netstackid_t)(uintptr_t)kp->ks_private;
  59   63          netstack_t      *ns;
  60   64          sctp_stack_t    *sctps;
  61   65          mib2_sctp_t     sctp_mib;
  62   66  
  63      -        if (kp == NULL|| kp->ks_data == NULL)
       67 +        if (kp->ks_data == NULL)
  64   68                  return (EIO);
  65   69  
  66   70          if (rw == KSTAT_WRITE)
  67   71                  return (EACCES);
  68   72  
  69   73          ns = netstack_find_by_stackid(stackid);
  70   74          if (ns == NULL)
  71   75                  return (-1);
  72   76          sctps = ns->netstack_sctp;
  73   77          if (sctps == NULL) {
↓ open down ↓ 896 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX