summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Levon <john.levon@joyent.com>2019-07-11 04:04:43 -0700
committerJohn Levon <john.levon@joyent.com>2019-07-13 15:25:59 -0700
commit16dde0768ead07b31571fd1e6c998d7cf0a6ba80 (patch)
treebae1feac0c2b566812f799182d7ed328282c03b4
parent44b87cd4530ee2eeeca2ea50951b9007d61e8fed (diff)
downloadillumos-joyent-16dde0768ead07b31571fd1e6c998d7cf0a6ba80.tar.gz
11416 smbios_info_slot_peers() gets NULL check wrong
Reviewed by: Toomas Soome <tsoome@me.com> Reviewed by: Andy Fiddaman <andy@omniosce.org> Approved by: Dan McDonald <danmcd@joyent.com>
-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 2c67f2964a..b4f819852b 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) 2018, Joyent, Inc.
+ * Copyright 2019 Joyent, Inc.
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -698,7 +698,7 @@ smbios_info_slot_peers(smbios_hdl_t *shp, id_t id, uint_t *npeers,
smbios_slot_peer_t **peerp)
{
const smb_struct_t *stp = smb_lookup_id(shp, id);
- const smb_slot_t *slotp = (const smb_slot_t *)stp->smbst_hdr;
+ const smb_slot_t *slotp;
smbios_slot_peer_t *peer;
size_t minlen;
uint_t i;
@@ -706,6 +706,8 @@ smbios_info_slot_peers(smbios_hdl_t *shp, id_t id, uint_t *npeers,
if (stp == NULL)
return (-1); /* errno is set for us */
+ slotp = (const smb_slot_t *)stp->smbst_hdr;
+
if (stp->smbst_hdr->smbh_type != SMB_TYPE_SLOT)
return (smb_set_errno(shp, ESMB_TYPE));