Print this page
SKU fix for 5094

Split Close
Expand all
Collapse all
          --- old/usr/src/common/smbios/smb_info.c
          +++ new/usr/src/common/smbios/smb_info.c
↓ open down ↓ 404 lines elided ↑ open up ↑
 405  405          bbp->smbb_type = bb.smbbb_type;
 406  406          bbp->smbb_contn = bb.smbbb_cn;
 407  407  
 408  408          return (0);
 409  409  }
 410  410  
 411  411  int
 412  412  smbios_info_chassis(smbios_hdl_t *shp, id_t id, smbios_chassis_t *chp)
 413  413  {
 414  414          const smb_struct_t *stp = smb_lookup_id(shp, id);
 415      -        smb_chassis_t ch;
      415 +        /* Length is measurable by one byte, so it'll be no more than 255. */
      416 +        uint8_t buf[256]
      417 +        smb_chassis_t *ch = (smb_chassis_t *)&(buf[0]);
 416  418  
 417  419          if (stp == NULL)
 418  420                  return (-1); /* errno is set for us */
 419  421  
 420  422          if (stp->smbst_hdr->smbh_type != SMB_TYPE_CHASSIS)
 421  423                  return (smb_set_errno(shp, ESMB_TYPE));
 422  424  
 423      -        smb_info_bcopy(stp->smbst_hdr, &ch, sizeof (ch));
      425 +        smb_info_bcopy(stp->smbst_hdr, ch, sizeof (buf));
 424  426          bzero(chp, sizeof (smbios_chassis_t));
 425  427  
 426      -        chp->smbc_oemdata = ch.smbch_oemdata;
 427      -        chp->smbc_lock = (ch.smbch_type & SMB_CHT_LOCK) != 0;
 428      -        chp->smbc_type = ch.smbch_type & ~SMB_CHT_LOCK;
 429      -        chp->smbc_bustate = ch.smbch_bustate;
 430      -        chp->smbc_psstate = ch.smbch_psstate;
 431      -        chp->smbc_thstate = ch.smbch_thstate;
 432      -        chp->smbc_security = ch.smbch_security;
 433      -        chp->smbc_uheight = ch.smbch_uheight;
 434      -        chp->smbc_cords = ch.smbch_cords;
 435      -        chp->smbc_elems = ch.smbch_cn;
 436      -        chp->smbc_elemlen = ch.smbch_cm;
      428 +        chp->smbc_oemdata = ch->smbch_oemdata;
      429 +        chp->smbc_lock = (ch->smbch_type & SMB_CHT_LOCK) != 0;
      430 +        chp->smbc_type = ch->smbch_type & ~SMB_CHT_LOCK;
      431 +        chp->smbc_bustate = ch->smbch_bustate;
      432 +        chp->smbc_psstate = ch->smbch_psstate;
      433 +        chp->smbc_thstate = ch->smbch_thstate;
      434 +        chp->smbc_security = ch->smbch_security;
      435 +        chp->smbc_uheight = ch->smbch_uheight;
      436 +        chp->smbc_cords = ch->smbch_cords;
      437 +        chp->smbc_elems = ch->smbch_cn;
      438 +        chp->smbc_elemlen = ch->smbch_cm;
 437  439  
 438      -        if (shp->sh_smbvers >= SMB_VERSION_27)
 439      -                chp->smbc_sku = smb_strptr(stp, ch.smbch_sku);
      440 +        if (shp->sh_smbvers >= SMB_VERSION_27) {
      441 +                (void) strlcpy(chp->smbc_sku, SMB_CH_SKU(ch),
      442 +                    sizeof (chp->smbc_sku));
      443 +        }
 440  444  
 441  445          return (0);
 442  446  }
 443  447  
 444  448  int
 445  449  smbios_info_processor(smbios_hdl_t *shp, id_t id, smbios_processor_t *pp)
 446  450  {
 447  451          const smb_struct_t *stp = smb_lookup_id(shp, id);
 448  452          smb_processor_t p;
 449  453  
↓ open down ↓ 717 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX