summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorJohn Levon <john.levon@joyent.com>2018-12-19 19:00:27 +0000
committerJohn Levon <john.levon@joyent.com>2019-03-12 21:15:29 +0000
commit0b427924a934b5ebe2ecd53ed66d8e65892da75e (patch)
tree2eb6dd2d36bc746c8f9d323c147d3c04110ccb26 /usr/src
parentd6517bbd3d5d20a36c32ac87627207632e5934aa (diff)
downloadillumos-joyent-0b427924a934b5ebe2ecd53ed66d8e65892da75e.tar.gz
10145 smbios_info_boot() gets NULL check wrong
Reviewed by: Andy Stormont <astormont@racktopsystems.com> Reviewed by: Toomas Soome <tsoome@me.com> Reviewed by: Gergő Doma <domag02@gmail.com> Approved by: Richard Lowe <richlowe@richlowe.net>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/common/smbios/smb_info.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr/src/common/smbios/smb_info.c b/usr/src/common/smbios/smb_info.c
index b28413d6a5..eb39095bde 100644
--- a/usr/src/common/smbios/smb_info.c
+++ b/usr/src/common/smbios/smb_info.c
@@ -21,7 +21,7 @@
/*
* Copyright 2015 OmniTI Computer Consulting, Inc. All rights reserved.
- * Copyright (c) 2017, Joyent, Inc.
+ * Copyright (c) 2018, Joyent, Inc.
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -983,13 +983,15 @@ id_t
smbios_info_boot(smbios_hdl_t *shp, smbios_boot_t *bp)
{
const smb_struct_t *stp = smb_lookup_type(shp, SMB_TYPE_BOOT);
- const smb_boot_t *b = (smb_boot_t *)(uintptr_t)stp->smbst_hdr;
+ const smb_boot_t *b;
if (stp == NULL)
return (-1); /* errno is set for us */
bzero(bp, sizeof (smbios_boot_t));
+ b = (smb_boot_t *)(uintptr_t)stp->smbst_hdr;
+
bp->smbt_status = b->smbbo_status[0];
bp->smbt_size = stp->smbst_hdr->smbh_len - sizeof (smb_boot_t);
bp->smbt_data = bp->smbt_size ? &b->smbbo_status[1] : NULL;