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/ip/icmp.c
          +++ new/usr/src/uts/common/inet/ip/icmp.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  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   * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   * Copyright (c) 2013 by Delphix. All rights reserved.
  24   24   * Copyright 2014, OmniTI Computer Consulting, Inc. All rights reserved.
       25 + * Copyright (c) 2018, Joyent, Inc.
  25   26   */
  26   27  /* Copyright (c) 1990 Mentat Inc. */
  27   28  
  28   29  #include <sys/types.h>
  29   30  #include <sys/stream.h>
  30   31  #include <sys/stropts.h>
  31   32  #include <sys/strlog.h>
  32   33  #include <sys/strsun.h>
  33   34  #define _SUN_TPI_VERSION 2
  34   35  #include <sys/tihdr.h>
↓ open down ↓ 5030 lines elided ↑ open up ↑
5065 5066  }
5066 5067  
5067 5068  static int
5068 5069  rawip_kstat_update(kstat_t *ksp, int rw)
5069 5070  {
5070 5071          rawip_named_kstat_t *rawipkp;
5071 5072          netstackid_t    stackid = (netstackid_t)(uintptr_t)ksp->ks_private;
5072 5073          netstack_t      *ns;
5073 5074          icmp_stack_t    *is;
5074 5075  
5075      -        if ((ksp == NULL) || (ksp->ks_data == NULL))
     5076 +        if (ksp->ks_data == NULL)
5076 5077                  return (EIO);
5077 5078  
5078 5079          if (rw == KSTAT_WRITE)
5079 5080                  return (EACCES);
5080 5081  
5081 5082          rawipkp = (rawip_named_kstat_t *)ksp->ks_data;
5082 5083  
5083 5084          ns = netstack_find_by_stackid(stackid);
5084 5085          if (ns == NULL)
5085 5086                  return (-1);
↓ open down ↓ 777 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX