summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2018-03-21 12:12:30 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2018-03-21 12:12:30 +0000
commit15c41273372517a01fee3e63e3ce3edbe11a8de1 (patch)
treec75123a549e584425f8ad7d8c6dde19376478063
parent80caa2e90432a6929d577979f0d62a577d583b69 (diff)
parent14ae03cbd0ae825189ca16e280cef1759c76f949 (diff)
downloadillumos-joyent-15c41273372517a01fee3e63e3ce3edbe11a8de1.tar.gz
[illumos-gate merge]
commit 14ae03cbd0ae825189ca16e280cef1759c76f949 9317 FMD crashes with zero-length allocation
-rw-r--r--usr/src/lib/scsi/plugins/ses/ses2/common/ses2_element.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr/src/lib/scsi/plugins/ses/ses2/common/ses2_element.c b/usr/src/lib/scsi/plugins/ses/ses2/common/ses2_element.c
index f6c71b4743..3b53e3294f 100644
--- a/usr/src/lib/scsi/plugins/ses/ses2/common/ses2_element.c
+++ b/usr/src/lib/scsi/plugins/ses/ses2/common/ses2_element.c
@@ -21,11 +21,10 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#include <stddef.h>
#include <stdio.h>
@@ -872,6 +871,9 @@ elem_parse_aes_misc(const ses2_aes_descr_eip_impl_t *dep, nvlist_t *nvl,
(len - offsetof(ses2_aes_descr_sas1_impl_t,
sadsi_phys)) / sizeof (ses2_aes_phy1_descr_impl_t));
+ if (nphy == 0)
+ return (0);
+
nva = ses_zalloc(nphy * sizeof (nvlist_t *));
if (nva == NULL)
return (-1);