diff options
author | Dan McDonald <danmcd@joyent.com> | 2020-09-22 10:39:49 -0400 |
---|---|---|
committer | Dan McDonald <danmcd@joyent.com> | 2020-09-22 10:39:49 -0400 |
commit | 267e12a7d9bf6e5fcefb9cc00f46bfff0dc5226e (patch) | |
tree | 19a3941920d0039c35d53a5cbee189b5ca51995a /usr/src/common | |
parent | 517abc5c668925e6092495bf332233c3599980d2 (diff) | |
parent | e9faba760cdf80d7dfa110fe0830917ab94668c2 (diff) | |
download | illumos-joyent-vpc.tar.gz |
Merge branch 'master' into vpcvpc
Diffstat (limited to 'usr/src/common')
-rw-r--r-- | usr/src/common/font/font.c | 3 | ||||
-rw-r--r-- | usr/src/common/smbios/smb_info.c | 42 | ||||
-rw-r--r-- | usr/src/common/smbios/smb_open.c | 1 |
3 files changed, 40 insertions, 6 deletions
diff --git a/usr/src/common/font/font.c b/usr/src/common/font/font.c index 3556f27cf8..f46c34a988 100644 --- a/usr/src/common/font/font.c +++ b/usr/src/common/font/font.c @@ -222,7 +222,8 @@ set_font(short *rows, short *cols, short h, short w) font = fl->font_data; if ((((*rows * font->height) + BORDER_PIXELS) <= height) && (((*cols * font->width) + BORDER_PIXELS) <= width)) { - if (font->font == NULL) { + if (font->font == NULL || + fl->font_flags == FONT_RELOAD) { if (fl->font_load != NULL && fl->font_name != NULL) { font = fl->font_load(fl->font_name); diff --git a/usr/src/common/smbios/smb_info.c b/usr/src/common/smbios/smb_info.c index 47c19e7fcb..9aba4deba8 100644 --- a/usr/src/common/smbios/smb_info.c +++ b/usr/src/common/smbios/smb_info.c @@ -22,6 +22,7 @@ /* * Copyright 2015 OmniTI Computer Consulting, Inc. All rights reserved. * Copyright 2019 Joyent, Inc. + * Copyright 2020 Oxide Computer Company * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -232,13 +233,24 @@ smb_info_strptr(const smb_struct_t *stp, uint8_t off, int *n) } static void +smb_info_bcopy_offset(const smb_header_t *hp, void *dst, size_t dstlen, + size_t offset) +{ + if (offset >= hp->smbh_len) { + bzero(dst, dstlen); + } else if (offset + dstlen > hp->smbh_len) { + size_t nvalid = MIN(hp->smbh_len - offset, dstlen); + bcopy((char *)hp + offset, dst, nvalid); + bzero((char *)dst + nvalid, dstlen - nvalid); + } else { + bcopy((char *)hp + offset, dst, dstlen); + } +} + +static void smb_info_bcopy(const smb_header_t *hp, void *dst, size_t dstlen) { - if (dstlen > hp->smbh_len) { - bcopy(hp, dst, hp->smbh_len); - bzero((char *)dst + hp->smbh_len, dstlen - hp->smbh_len); - } else - bcopy(hp, dst, dstlen); + return (smb_info_bcopy_offset(hp, dst, dstlen, 0)); } smbios_entry_point_t @@ -674,6 +686,8 @@ smbios_info_slot(smbios_hdl_t *shp, id_t id, smbios_slot_t *sp) { const smb_struct_t *stp = smb_lookup_id(shp, id); smb_slot_t s; + smb_slot_cont_t cont; + size_t off; if (stp == NULL) return (-1); /* errno is set for us */ @@ -701,6 +715,24 @@ smbios_info_slot(smbios_hdl_t *shp, id_t id, smbios_slot_t *sp) sp->smbl_npeers = s.smbsl_npeers; } + if (!smb_libgteq(shp, SMB_VERSION_34)) { + return (0); + } + + /* + * In SMBIOS 3.4, several members were added to follow the variable + * number of peers. These are defined to start at byte 0x14 + 5 * + * npeers. If the table is from before 3.4, we simple zero things out. + * Otherwise we check if the length covers the peers and this addendum + * to include it as the table length is allowed to be less than this and + * not include it. + */ + off = SMB_SLOT_CONT_START + 5 * s.smbsl_npeers; + smb_info_bcopy_offset(stp->smbst_hdr, &cont, sizeof (cont), off); + sp->smbl_info = cont.smbsl_info; + sp->smbl_pwidth = cont.smbsl_pwidth; + sp->smbl_pitch = cont.smbsl_pitch; + return (0); } diff --git a/usr/src/common/smbios/smb_open.c b/usr/src/common/smbios/smb_open.c index 372b2b619b..6747c84499 100644 --- a/usr/src/common/smbios/smb_open.c +++ b/usr/src/common/smbios/smb_open.c @@ -231,6 +231,7 @@ smbios_bufopen(const smbios_entry_t *ep, const void *buf, size_t len, case SMB_VERSION_31: case SMB_VERSION_32: case SMB_VERSION_33: + case SMB_VERSION_34: break; default: return (smb_open_error(shp, errp, ESMB_VERSION)); |