Print this page
10082 intel_nhm is checking for NULL arrays

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/intel/io/intel_nhm/dimm_topo.c
          +++ new/usr/src/uts/intel/io/intel_nhm/dimm_topo.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  /*
  23   23   * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  
       27 +/*
       28 + * Copyright (c) 2018, Joyent, Inc.
       29 + */
       30 +
  27   31  #include <sys/types.h>
  28   32  #include <sys/time.h>
  29   33  #include <sys/nvpair.h>
  30   34  #include <sys/cmn_err.h>
  31   35  #include <sys/cred.h>
  32   36  #include <sys/open.h>
  33   37  #include <sys/ddi.h>
  34   38  #include <sys/sunddi.h>
  35   39  #include <sys/conf.h>
  36   40  #include <sys/modctl.h>
↓ open down ↓ 112 lines elided ↑ open up ↑
 149  153          (void) nvlist_add_string(newdimm, "dimm-size", sbuf);
 150  154          (void) nvlist_add_uint64(newdimm, "size", nhm_dimm->dimm_size);
 151  155          (void) nvlist_add_uint32(newdimm, "nbanks", (uint32_t)nhm_dimm->nbanks);
 152  156          (void) nvlist_add_uint32(newdimm, "ncolumn",
 153  157              (uint32_t)nhm_dimm->ncolumn);
 154  158          (void) nvlist_add_uint32(newdimm, "nrow", (uint32_t)nhm_dimm->nrow);
 155  159          (void) nvlist_add_uint32(newdimm, "width", (uint32_t)nhm_dimm->width);
 156  160          (void) nvlist_add_uint32(newdimm, "ranks", (uint32_t)nhm_dimm->nranks);
 157  161          inhm_rank(newdimm, nhm_dimm, node, channel, dimm,
 158  162              nhm_dimm->dimm_size / nhm_dimm->nranks);
 159      -        if (nhm_dimm->manufacturer && nhm_dimm->manufacturer[0]) {
      163 +        if (nhm_dimm->manufacturer[0]) {
 160  164                  t = sizeof (nhm_dimm->manufacturer);
 161  165                  (void) strncpy(sbuf, nhm_dimm->manufacturer, t);
 162  166                  sbuf[t] = 0;
 163  167                  (void) nvlist_add_string(newdimm, "manufacturer", sbuf);
 164  168          }
 165      -        if (nhm_dimm->serial_number && nhm_dimm->serial_number[0]) {
      169 +        if (nhm_dimm->serial_number[0]) {
 166  170                  t = sizeof (nhm_dimm->serial_number);
 167  171                  (void) strncpy(sbuf, nhm_dimm->serial_number, t);
 168  172                  sbuf[t] = 0;
 169  173                  (void) nvlist_add_string(newdimm, FM_FMRI_HC_SERIAL_ID, sbuf);
 170  174          }
 171      -        if (nhm_dimm->part_number && nhm_dimm->part_number[0]) {
      175 +        if (nhm_dimm->part_number[0]) {
 172  176                  t = sizeof (nhm_dimm->part_number);
 173  177                  (void) strncpy(sbuf, nhm_dimm->part_number, t);
 174  178                  sbuf[t] = 0;
 175  179                  (void) nvlist_add_string(newdimm, FM_FMRI_HC_PART, sbuf);
 176  180          }
 177      -        if (nhm_dimm->revision && nhm_dimm->revision[0]) {
      181 +        if (nhm_dimm->revision[0]) {
 178  182                  t = sizeof (nhm_dimm->revision);
 179  183                  (void) strncpy(sbuf, nhm_dimm->revision, t);
 180  184                  sbuf[t] = 0;
 181  185                  (void) nvlist_add_string(newdimm, FM_FMRI_HC_REVISION, sbuf);
 182  186          }
 183  187          t = sizeof (nhm_dimm->label);
 184  188          (void) strncpy(sbuf, nhm_dimm->label, t);
 185  189          sbuf[t] = 0;
 186  190          (void) nvlist_add_string(newdimm, FM_FAULT_FRU_LABEL, sbuf);
 187  191          return (newdimm);
↓ open down ↓ 80 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX