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/ip.c
          +++ new/usr/src/uts/common/inet/ip/ip.c
↓ open down ↓ 14067 lines elided ↑ open up ↑
14068 14068  ip_kstat_update(kstat_t *kp, int rw)
14069 14069  {
14070 14070          ip_named_kstat_t *ipkp;
14071 14071          mib2_ipIfStatsEntry_t ipmib;
14072 14072          ill_walk_context_t ctx;
14073 14073          ill_t *ill;
14074 14074          netstackid_t    stackid = (zoneid_t)(uintptr_t)kp->ks_private;
14075 14075          netstack_t      *ns;
14076 14076          ip_stack_t      *ipst;
14077 14077  
14078      -        if (kp == NULL || kp->ks_data == NULL)
     14078 +        if (kp->ks_data == NULL)
14079 14079                  return (EIO);
14080 14080  
14081 14081          if (rw == KSTAT_WRITE)
14082 14082                  return (EACCES);
14083 14083  
14084 14084          ns = netstack_find_by_stackid(stackid);
14085 14085          if (ns == NULL)
14086 14086                  return (-1);
14087 14087          ipst = ns->netstack_ip;
14088 14088          if (ipst == NULL) {
↓ open down ↓ 116 lines elided ↑ open up ↑
14205 14205  }
14206 14206  
14207 14207  static int
14208 14208  icmp_kstat_update(kstat_t *kp, int rw)
14209 14209  {
14210 14210          icmp_named_kstat_t *icmpkp;
14211 14211          netstackid_t    stackid = (zoneid_t)(uintptr_t)kp->ks_private;
14212 14212          netstack_t      *ns;
14213 14213          ip_stack_t      *ipst;
14214 14214  
14215      -        if ((kp == NULL) || (kp->ks_data == NULL))
     14215 +        if (kp->ks_data == NULL)
14216 14216                  return (EIO);
14217 14217  
14218 14218          if (rw == KSTAT_WRITE)
14219 14219                  return (EACCES);
14220 14220  
14221 14221          ns = netstack_find_by_stackid(stackid);
14222 14222          if (ns == NULL)
14223 14223                  return (-1);
14224 14224          ipst = ns->netstack_ip;
14225 14225          if (ipst == NULL) {
↓ open down ↓ 1065 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX