Print this page
10082 intel_nhm is checking for NULL arrays
*** 22,31 ****
--- 22,35 ----
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+ /*
+ * Copyright (c) 2018, Joyent, Inc.
+ */
+
#include <sys/types.h>
#include <sys/time.h>
#include <sys/nvpair.h>
#include <sys/cmn_err.h>
#include <sys/cred.h>
*** 154,182 ****
(void) nvlist_add_uint32(newdimm, "nrow", (uint32_t)nhm_dimm->nrow);
(void) nvlist_add_uint32(newdimm, "width", (uint32_t)nhm_dimm->width);
(void) nvlist_add_uint32(newdimm, "ranks", (uint32_t)nhm_dimm->nranks);
inhm_rank(newdimm, nhm_dimm, node, channel, dimm,
nhm_dimm->dimm_size / nhm_dimm->nranks);
! if (nhm_dimm->manufacturer && nhm_dimm->manufacturer[0]) {
t = sizeof (nhm_dimm->manufacturer);
(void) strncpy(sbuf, nhm_dimm->manufacturer, t);
sbuf[t] = 0;
(void) nvlist_add_string(newdimm, "manufacturer", sbuf);
}
! if (nhm_dimm->serial_number && nhm_dimm->serial_number[0]) {
t = sizeof (nhm_dimm->serial_number);
(void) strncpy(sbuf, nhm_dimm->serial_number, t);
sbuf[t] = 0;
(void) nvlist_add_string(newdimm, FM_FMRI_HC_SERIAL_ID, sbuf);
}
! if (nhm_dimm->part_number && nhm_dimm->part_number[0]) {
t = sizeof (nhm_dimm->part_number);
(void) strncpy(sbuf, nhm_dimm->part_number, t);
sbuf[t] = 0;
(void) nvlist_add_string(newdimm, FM_FMRI_HC_PART, sbuf);
}
! if (nhm_dimm->revision && nhm_dimm->revision[0]) {
t = sizeof (nhm_dimm->revision);
(void) strncpy(sbuf, nhm_dimm->revision, t);
sbuf[t] = 0;
(void) nvlist_add_string(newdimm, FM_FMRI_HC_REVISION, sbuf);
}
--- 158,186 ----
(void) nvlist_add_uint32(newdimm, "nrow", (uint32_t)nhm_dimm->nrow);
(void) nvlist_add_uint32(newdimm, "width", (uint32_t)nhm_dimm->width);
(void) nvlist_add_uint32(newdimm, "ranks", (uint32_t)nhm_dimm->nranks);
inhm_rank(newdimm, nhm_dimm, node, channel, dimm,
nhm_dimm->dimm_size / nhm_dimm->nranks);
! if (nhm_dimm->manufacturer[0]) {
t = sizeof (nhm_dimm->manufacturer);
(void) strncpy(sbuf, nhm_dimm->manufacturer, t);
sbuf[t] = 0;
(void) nvlist_add_string(newdimm, "manufacturer", sbuf);
}
! if (nhm_dimm->serial_number[0]) {
t = sizeof (nhm_dimm->serial_number);
(void) strncpy(sbuf, nhm_dimm->serial_number, t);
sbuf[t] = 0;
(void) nvlist_add_string(newdimm, FM_FMRI_HC_SERIAL_ID, sbuf);
}
! if (nhm_dimm->part_number[0]) {
t = sizeof (nhm_dimm->part_number);
(void) strncpy(sbuf, nhm_dimm->part_number, t);
sbuf[t] = 0;
(void) nvlist_add_string(newdimm, FM_FMRI_HC_PART, sbuf);
}
! if (nhm_dimm->revision[0]) {
t = sizeof (nhm_dimm->revision);
(void) strncpy(sbuf, nhm_dimm->revision, t);
sbuf[t] = 0;
(void) nvlist_add_string(newdimm, FM_FMRI_HC_REVISION, sbuf);
}