summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2017-03-06 13:07:55 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2017-03-06 13:07:55 +0000
commitcedddd0bb5c808632ca226e9f66ab136098d1b2c (patch)
tree971adb1381c693aa122361817677be4dc3cb3d50
parent91d2d9664188336e93786a92761888d1e299c88f (diff)
parent015408caf0806500740413126a0215c7493f4bdf (diff)
downloadillumos-joyent-cedddd0bb5c808632ca226e9f66ab136098d1b2c.tar.gz
[illumos-gate merge]
commit 015408caf0806500740413126a0215c7493f4bdf 7934 sa_init() should use multi-threaded errno commit 25d3556849fcbe4fe5d517e1add48e0b2d585c70 7933 libcfgadm: memory leak in do_list_common() commit 89ac1330de393e78c8b27c33453223b10d3c18da 7932 cfgadm_plugins/shp: memory leaks in cfga_list_ext() commit 39b16bd33a2633978bee6aed53e3afeb26399eb4 7840 Define uint16_t member in in6_addr commit e1508819051004d7be493a04ee515905ae412142 6899 coverity problems in localedef commit 8241ccbb39665a24ebedcca509f82ef3f0b6dd83 6470 mac_unregister() needs to mod_hash_remove() BEFORE holding the perimeter. commit 6e28b3a925501ed4b842fd8e877e8a89989a4c5c 7897 loader.efi: Use 32-bit value for .text padding, for linker portability commit e3ed3d332db66cf933650481f47832aaadb70ec3 7862 libdisasm: left shift of negative value commit a536a2a3182b56eef2630fb4b4509c9e106655e6 7722 bootblock versioning needs to deal with missing data commit baa708d63390757ca1a97444649f2fe4d3ae98f0 7926 enable gcc warnings for sd Conflicts: usr/src/uts/common/io/scsi/targets/sd.c
-rw-r--r--usr/src/boot/sys/boot/efi/loader/arch/amd64/ldscript.amd642
-rw-r--r--usr/src/boot/sys/boot/efi/loader/arch/arm64/ldscript.arm642
-rw-r--r--usr/src/boot/sys/boot/efi/loader/arch/i386/ldscript.i3862
-rw-r--r--usr/src/cmd/boot/common/bblk_einfo.c43
-rw-r--r--usr/src/cmd/localedef/collate.c9
-rw-r--r--usr/src/cmd/localedef/ctype.c32
-rw-r--r--usr/src/cmd/localedef/localedef.c27
-rw-r--r--usr/src/cmd/localedef/localedef.h3
-rw-r--r--usr/src/cmd/localedef/time.c6
-rw-r--r--usr/src/lib/cfgadm_plugins/shp/common/shp.c11
-rw-r--r--usr/src/lib/libcfgadm/common/config_admin.c17
-rw-r--r--usr/src/lib/libdevinfo/devinfo.c2
-rw-r--r--usr/src/lib/libdisasm/common/dis_sparc_fmt.c12
-rw-r--r--usr/src/lib/libshare/common/libshare.c2
-rw-r--r--usr/src/uts/common/io/mac/mac_provider.c17
-rw-r--r--usr/src/uts/common/io/scsi/targets/sd.c203
-rw-r--r--usr/src/uts/common/io/scsi/targets/sd_xbuf.c7
-rw-r--r--usr/src/uts/common/netinet/in.h3
-rw-r--r--usr/src/uts/i86pc/i86hvm/hvm_sd/Makefile7
-rw-r--r--usr/src/uts/intel/sd/Makefile7
-rw-r--r--usr/src/uts/sparc/sd/Makefile7
21 files changed, 226 insertions, 195 deletions
diff --git a/usr/src/boot/sys/boot/efi/loader/arch/amd64/ldscript.amd64 b/usr/src/boot/sys/boot/efi/loader/arch/amd64/ldscript.amd64
index d9a83faf1b..f43f483808 100644
--- a/usr/src/boot/sys/boot/efi/loader/arch/amd64/ldscript.amd64
+++ b/usr/src/boot/sys/boot/efi/loader/arch/amd64/ldscript.amd64
@@ -18,7 +18,7 @@ SECTIONS
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
*(.plt)
- } =0x00300000010070000002000001000400
+ } =0xCCCCCCCC
. = ALIGN(4096);
.data : {
*(.rodata .rodata.* .gnu.linkonce.r.*)
diff --git a/usr/src/boot/sys/boot/efi/loader/arch/arm64/ldscript.arm64 b/usr/src/boot/sys/boot/efi/loader/arch/arm64/ldscript.arm64
index 7b62eaa4d6..29b807b250 100644
--- a/usr/src/boot/sys/boot/efi/loader/arch/arm64/ldscript.arm64
+++ b/usr/src/boot/sys/boot/efi/loader/arch/arm64/ldscript.arm64
@@ -15,7 +15,7 @@ SECTIONS
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
*(.plt)
- } =0x00300000010070000002000001000400
+ } =0xD4200000
. = ALIGN(16);
.data : {
*(.rodata .rodata.* .gnu.linkonce.r.*)
diff --git a/usr/src/boot/sys/boot/efi/loader/arch/i386/ldscript.i386 b/usr/src/boot/sys/boot/efi/loader/arch/i386/ldscript.i386
index fdfda0a05c..4b28c104a3 100644
--- a/usr/src/boot/sys/boot/efi/loader/arch/i386/ldscript.i386
+++ b/usr/src/boot/sys/boot/efi/loader/arch/i386/ldscript.i386
@@ -14,7 +14,7 @@ SECTIONS
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
*(.plt)
- } =0x00300000010070000002000001000400
+ } =0xCCCCCCCC
. = ALIGN(4096);
.data : {
*(.rodata .rodata.* .gnu.linkonce.r.*)
diff --git a/usr/src/cmd/boot/common/bblk_einfo.c b/usr/src/cmd/boot/common/bblk_einfo.c
index 99b0ced815..6ddb750aa7 100644
--- a/usr/src/cmd/boot/common/bblk_einfo.c
+++ b/usr/src/cmd/boot/common/bblk_einfo.c
@@ -136,6 +136,17 @@ einfo_compare_timestamps(const char *str1, const char *str2)
* 0 - if the two versions coincide
* 1 - if the version in str1 is more recent
* 2 - if the version in str2 is more recent
+ *
+ * The version string generally uses following form:
+ * self_release,build_release:timestamp
+ * The release numbers are compared as dotted versions.
+ *
+ * While comparing, if the self releases are identical but the build
+ * release is missing, this version string is considered older.
+ *
+ * If the release strings are identical, and one of the timestamps is missing,
+ * we return an error. Otherwise, return the result from comparing the
+ * timestamps.
*/
static int
einfo_compare_version(const char *str1, const char *str2)
@@ -143,6 +154,7 @@ einfo_compare_version(const char *str1, const char *str2)
int retval = 0;
char *verstr1, *verstr2, *freeptr1, *freeptr2;
char *parsep1, *parsep2;
+ char *timep1, *timep2;
freeptr1 = verstr1 = strdup(str1);
freeptr2 = verstr2 = strdup(str2);
@@ -151,16 +163,26 @@ einfo_compare_version(const char *str1, const char *str2)
goto out;
}
- parsep1 = verstr1;
- parsep2 = verstr2;
+ /* Extract the time part from the version string. */
+ timep1 = verstr1;
+ timep2 = verstr2;
+ parsep1 = strsep(&timep1, ":");
+ parsep2 = strsep(&timep2, ":");
while (parsep1 != NULL && parsep2 != NULL) {
- parsep1 = strsep(&verstr1, ",:-");
- parsep2 = strsep(&verstr2, ",:-");
+ parsep1 = strsep(&verstr1, ",-");
+ parsep2 = strsep(&verstr2, ",-");
- /* verstr1 or verstr2 will be NULL before parsep1 or parsep2. */
- if (verstr1 == NULL || verstr2 == NULL) {
- retval = einfo_compare_timestamps(parsep1, parsep2);
+ /* If both are NULL, compare timestamps */
+ if (parsep1 == NULL && parsep2 == NULL)
+ break;
+
+ if (parsep1 == NULL) {
+ retval = 2;
+ goto out;
+ }
+ if (parsep2 == NULL) {
+ retval = 1;
goto out;
}
@@ -170,6 +192,13 @@ einfo_compare_version(const char *str1, const char *str2)
else
goto out;
}
+
+ /* The dotted versions are identical, check timestamps. */
+ if (timep1 == NULL || timep2 == NULL) {
+ retval = -1;
+ goto out;
+ }
+ retval = einfo_compare_timestamps(timep1, timep2);
out:
free(freeptr1);
free(freeptr2);
diff --git a/usr/src/cmd/localedef/collate.c b/usr/src/cmd/localedef/collate.c
index 6fefe5f648..e71d55abe8 100644
--- a/usr/src/cmd/localedef/collate.c
+++ b/usr/src/cmd/localedef/collate.c
@@ -10,7 +10,7 @@
*/
/*
- * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2017 Nexenta Systems, Inc.
*/
/*
@@ -477,6 +477,7 @@ define_collsym(char *name)
* This should never happen because we are only called
* for undefined symbols.
*/
+ free(sym);
INTERR;
return;
}
@@ -514,6 +515,7 @@ get_collundef(char *name)
if (((ud = calloc(sizeof (*ud), 1)) == NULL) ||
((ud->name = strdup(name)) == NULL)) {
errf(_("out of memory"));
+ free(ud);
return (NULL);
}
for (i = 0; i < NUM_WT; i++) {
@@ -791,6 +793,7 @@ define_collelem(char *name, wchar_t *wcs)
if ((avl_find(&elem_by_symbol, e, &where1) != NULL) ||
(avl_find(&elem_by_expand, e, &where2) != NULL)) {
errf(_("duplicate collating element definition"));
+ free(e);
return;
}
avl_insert(&elem_by_symbol, e, where1);
@@ -1241,21 +1244,25 @@ dump_collate(void)
if ((wr_category(vers, COLLATE_STR_LEN, f) < 0) ||
(wr_category(&collinfo, sizeof (collinfo), f) < 0) ||
(wr_category(&chars, sizeof (chars), f) < 0)) {
+ delete_category(f);
return;
}
for (i = 0; i < NUM_WT; i++) {
sz = sizeof (collate_subst_t) * collinfo.subst_count[i];
if (wr_category(subst[i], sz, f) < 0) {
+ delete_category(f);
return;
}
}
sz = sizeof (collate_chain_t) * collinfo.chain_count;
if (wr_category(chain, sz, f) < 0) {
+ delete_category(f);
return;
}
sz = sizeof (collate_large_t) * collinfo.large_count;
if (wr_category(large, sz, f) < 0) {
+ delete_category(f);
return;
}
diff --git a/usr/src/cmd/localedef/ctype.c b/usr/src/cmd/localedef/ctype.c
index 18e308ccff..1f40f49ca0 100644
--- a/usr/src/cmd/localedef/ctype.c
+++ b/usr/src/cmd/localedef/ctype.c
@@ -10,7 +10,7 @@
*/
/*
- * Copyright 2010,2011 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2017 Nexenta Systems, Inc.
* Copyright 2012 Garrett D'Amore <garrett@damore.org>
* Copyright 2013 DEY Storage Systems, Inc.
*/
@@ -273,7 +273,7 @@ dump_ctype(void)
return;
(void) memcpy(rl.magic, _FILE_RUNE_MAGIC_1, 8);
- (void) strncpy(rl.encoding, get_wide_encoding(), sizeof (rl.encoding));
+ (void) strlcpy(rl.encoding, get_wide_encoding(), sizeof (rl.encoding));
/*
* Initialize the identity map.
@@ -347,12 +347,12 @@ dump_ctype(void)
if ((ctn->ctype & _ISALPHA) &&
(ctn->ctype & (_ISPUNCT|_ISDIGIT)))
conflict++;
- if ((ctn->ctype & _ISPUNCT) &
+ if ((ctn->ctype & _ISPUNCT) &&
(ctn->ctype & (_ISDIGIT|_ISALPHA|_ISXDIGIT)))
conflict++;
if ((ctn->ctype & _ISSPACE) && (ctn->ctype & _ISGRAPH))
conflict++;
- if ((ctn->ctype & _ISCNTRL) & _ISPRINT)
+ if ((ctn->ctype & _ISCNTRL) && (ctn->ctype & _ISPRINT))
conflict++;
if ((wc == ' ') && (ctn->ctype & (_ISPUNCT|_ISGRAPH)))
conflict++;
@@ -384,6 +384,8 @@ dump_ctype(void)
rl.runetype_ext_nranges++;
ct = realloc(ct,
sizeof (*ct) * rl.runetype_ext_nranges);
+ if (ct == NULL)
+ goto fail;
ct[rl.runetype_ext_nranges - 1].min = wc;
ct[rl.runetype_ext_nranges - 1].max = wc;
ct[rl.runetype_ext_nranges - 1].map = ctn->ctype;
@@ -399,6 +401,8 @@ dump_ctype(void)
rl.maplower_ext_nranges++;
lo = realloc(lo,
sizeof (*lo) * rl.maplower_ext_nranges);
+ if (lo == NULL)
+ goto fail;
lo[rl.maplower_ext_nranges - 1].min = wc;
lo[rl.maplower_ext_nranges - 1].max = wc;
lo[rl.maplower_ext_nranges - 1].map = ctn->tolower;
@@ -415,6 +419,8 @@ dump_ctype(void)
rl.mapupper_ext_nranges++;
up = realloc(up,
sizeof (*up) * rl.mapupper_ext_nranges);
+ if (up == NULL)
+ goto fail;
up[rl.mapupper_ext_nranges - 1].min = wc;
up[rl.mapupper_ext_nranges - 1].max = wc;
up[rl.mapupper_ext_nranges - 1].map = ctn->toupper;
@@ -422,12 +428,18 @@ dump_ctype(void)
}
}
- if ((wr_category(&rl, sizeof (rl), f) < 0) ||
- (wr_category(ct, sizeof (*ct) * rl.runetype_ext_nranges, f) < 0) ||
- (wr_category(lo, sizeof (*lo) * rl.maplower_ext_nranges, f) < 0) ||
- (wr_category(up, sizeof (*up) * rl.mapupper_ext_nranges, f) < 0)) {
- return;
+ if ((wr_category(&rl, sizeof (rl), f) == 0) &&
+ (wr_category(ct, sizeof (*ct) * rl.runetype_ext_nranges, f) == 0) &&
+ (wr_category(lo, sizeof (*lo) * rl.maplower_ext_nranges, f) == 0) &&
+ (wr_category(up, sizeof (*up) * rl.mapupper_ext_nranges, f) == 0)) {
+ close_category(f);
+ goto out;
}
- close_category(f);
+fail:
+ delete_category(f);
+out:
+ free(ct);
+ free(lo);
+ free(up);
}
diff --git a/usr/src/cmd/localedef/localedef.c b/usr/src/cmd/localedef/localedef.c
index 9936c80bb8..64bd0c36d6 100644
--- a/usr/src/cmd/localedef/localedef.c
+++ b/usr/src/cmd/localedef/localedef.c
@@ -10,7 +10,7 @@
*/
/*
- * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2017 Nexenta Systems, Inc.
* Copyright 2013 DEY Storage Systems, Inc.
*/
@@ -104,16 +104,19 @@ open_category(void)
}
void
+delete_category(FILE *f)
+{
+ (void) fclose(f);
+ (void) unlink(category_file());
+}
+
+void
close_category(FILE *f)
{
- if (fchmod(fileno(f), 0644) < 0) {
- (void) fclose(f);
- (void) unlink(category_file());
- errf(strerror(errno));
- }
- if (fclose(f) < 0) {
- (void) unlink(category_file());
+ if (fchmod(fileno(f), 0644) < 0 ||
+ fclose(f) != 0) {
errf(strerror(errno));
+ delete_category(f);
}
if (verbose) {
(void) fprintf(stdout, _("done.\n"));
@@ -169,15 +172,13 @@ int
putl_category(const char *s, FILE *f)
{
if (s && fputs(s, f) == EOF) {
- (void) fclose(f);
- (void) unlink(category_file());
errf(strerror(errno));
+ delete_category(f);
return (EOF);
}
if (fputc('\n', f) == EOF) {
- (void) fclose(f);
- (void) unlink(category_file());
errf(strerror(errno));
+ delete_category(f);
return (EOF);
}
return (0);
@@ -190,8 +191,6 @@ wr_category(void *buf, size_t sz, FILE *f)
return (0);
}
if (fwrite(buf, sz, 1, f) < 1) {
- (void) fclose(f);
- (void) unlink(category_file());
errf(strerror(errno));
return (EOF);
}
diff --git a/usr/src/cmd/localedef/localedef.h b/usr/src/cmd/localedef/localedef.h
index 9766d49e82..5638f13d6e 100644
--- a/usr/src/cmd/localedef/localedef.h
+++ b/usr/src/cmd/localedef/localedef.h
@@ -10,7 +10,7 @@
*/
/*
- * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2017 Nexenta Systems, Inc.
* Copyright 2013 DEY Storage Systmes, Inc.
*/
@@ -44,6 +44,7 @@ void warn(const char *, ...);
int putl_category(const char *, FILE *);
int wr_category(void *, size_t, FILE *);
FILE *open_category(void);
+void delete_category(FILE *);
void close_category(FILE *);
void copy_category(char *);
diff --git a/usr/src/cmd/localedef/time.c b/usr/src/cmd/localedef/time.c
index 8347f0ecb7..ab2d27d295 100644
--- a/usr/src/cmd/localedef/time.c
+++ b/usr/src/cmd/localedef/time.c
@@ -11,7 +11,7 @@
/*
* Copyright 2013 Garrett D'Amore <garrett@damore.org>
- * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2017 Nexenta Systems, Inc.
*/
/*
@@ -62,7 +62,7 @@ add_time_str(wchar_t *wcs)
break;
case T_DATE_FMT:
/*
- * This one is a Solaris extension, Too bad date just
+ * This one is a Solaris extension. Too bad date just
* doesn't use %c, which would be simpler.
*/
tm.date_fmt = str;
@@ -71,6 +71,7 @@ add_time_str(wchar_t *wcs)
case T_ERA_T_FMT:
case T_ERA_D_T_FMT:
/* Silently ignore it. */
+ free(str);
break;
default:
free(str);
@@ -123,6 +124,7 @@ add_time_list(wchar_t *wcs)
tm.pm = str;
} else {
errf(_("too many list elements"));
+ free(str);
}
break;
case T_ALT_DIGITS:
diff --git a/usr/src/lib/cfgadm_plugins/shp/common/shp.c b/usr/src/lib/cfgadm_plugins/shp/common/shp.c
index 50d335a1bc..f8bbda4f7f 100644
--- a/usr/src/lib/cfgadm_plugins/shp/common/shp.c
+++ b/usr/src/lib/cfgadm_plugins/shp/common/shp.c
@@ -1378,6 +1378,7 @@ cfga_list_ext(const char *ap_id, cfga_list_data_t **cs,
{
char *boardtype;
char *cardtype;
+ char *tmpb = NULL, *tmpc = NULL;
struct searcharg slotname_arg;
int fd;
int rv = CFGA_OK;
@@ -1498,16 +1499,16 @@ cfga_list_ext(const char *ap_id, cfga_list_data_t **cs,
(*cs)->ap_status_time = hp_last_change(node);
/* board type */
- if (hp_get_private(node, PCIEHPC_PROP_BOARD_TYPE, &boardtype) != 0)
+ if (hp_get_private(node, PCIEHPC_PROP_BOARD_TYPE, &tmpb) != 0)
boardtype = PCIEHPC_PROP_VALUE_UNKNOWN;
else
- boardtype = get_val_from_result(boardtype);
+ boardtype = get_val_from_result(tmpb);
/* card type */
- if (hp_get_private(node, PCIEHPC_PROP_CARD_TYPE, &cardtype) != 0)
+ if (hp_get_private(node, PCIEHPC_PROP_CARD_TYPE, &tmpc) != 0)
cardtype = PCIEHPC_PROP_VALUE_UNKNOWN;
else
- cardtype = get_val_from_result(cardtype);
+ cardtype = get_val_from_result(tmpc);
/* logical ap_id */
rv = fix_ap_name((*cs)->ap_log_id, ap_id,
@@ -1541,6 +1542,8 @@ cfga_list_ext(const char *ap_id, cfga_list_data_t **cs,
DBG(1, ("cfga_list_ext return success\n"));
rv = CFGA_OK;
+ free(tmpb);
+ free(tmpc);
hp_fini(node);
return (rv);
}
diff --git a/usr/src/lib/libcfgadm/common/config_admin.c b/usr/src/lib/libcfgadm/common/config_admin.c
index d642fa820b..767332c631 100644
--- a/usr/src/lib/libcfgadm/common/config_admin.c
+++ b/usr/src/lib/libcfgadm/common/config_admin.c
@@ -2570,26 +2570,27 @@ config_err(int errnum, int err_type, char **errstring)
* do_list_common - list non-SHP attachment point
*/
static int
-do_list_common(
- di_node_t node,
- di_minor_t minor,
- void *arg)
+do_list_common(di_node_t node, di_minor_t minor, void *arg)
{
di_node_t rnode;
di_hp_t hp;
char *minor_name;
+ char *phys_path;
- minor_name = di_minor_name(minor);
+ if ((minor_name = di_minor_name(minor)) == NULL)
+ return (DI_WALK_CONTINUE);
/*
* since PCIE/PCIHSHPC connectors have both hp nodes and minor nodes
* created for now, we need to specifically exclude these connectors
* during walking minor nodes.
*/
- if ((rnode = di_init(di_devfs_path(node), DINFOSUBTREE | DINFOHP))
- == DI_NODE_NIL) {
+ if ((phys_path = di_devfs_path(node)) == NULL)
+ return (DI_WALK_CONTINUE);
+ rnode = di_init(phys_path, DINFOSUBTREE | DINFOHP);
+ di_devfs_path_free(phys_path);
+ if (rnode == DI_NODE_NIL)
return (DI_WALK_CONTINUE);
- }
for (hp = DI_HP_NIL; (hp = di_hp_next(rnode, hp)) != DI_HP_NIL; ) {
if (strcmp(di_hp_name(hp), minor_name) == 0) {
diff --git a/usr/src/lib/libdevinfo/devinfo.c b/usr/src/lib/libdevinfo/devinfo.c
index 68e51960a2..678f891c90 100644
--- a/usr/src/lib/libdevinfo/devinfo.c
+++ b/usr/src/lib/libdevinfo/devinfo.c
@@ -1065,7 +1065,7 @@ di_driver_ops(di_node_t node)
}
/*
- * returns the length of the path, caller must free memory
+ * Returns pointer to the allocated string, which must be freed by the caller.
*/
char *
di_devfs_path(di_node_t node)
diff --git a/usr/src/lib/libdisasm/common/dis_sparc_fmt.c b/usr/src/lib/libdisasm/common/dis_sparc_fmt.c
index 017c056477..ceaafa47fe 100644
--- a/usr/src/lib/libdisasm/common/dis_sparc_fmt.c
+++ b/usr/src/lib/libdisasm/common/dis_sparc_fmt.c
@@ -32,6 +32,7 @@
#include <sys/byteorder.h>
+#include <sys/debug.h>
#include <stdarg.h>
#if !defined(DIS_STANDALONE)
@@ -647,7 +648,7 @@ static const char *prefetch_str[32] = {
static void prt_field(const char *, uint32_t, int);
static const char *get_regname(dis_handle_t *, int, uint32_t);
-static int32_t sign_extend(int32_t, int32_t);
+static int32_t sign_extend(int32_t, uint32_t);
static void prt_name(dis_handle_t *, const char *, int);
@@ -2203,12 +2204,13 @@ prt_field(const char *field, uint32_t val, int len)
* integer
*/
static int32_t
-sign_extend(int32_t val, int32_t bits)
+sign_extend(int32_t val, uint32_t bits)
{
- if ((val & (1L << (bits - 1))) == 0)
- return (val);
+ uint32_t mask;
- return ((-1L << bits) | val);
+ ASSERT(bits > 0);
+ mask = 1L << (bits - 1); /* 2**(bits - 1) */
+ return (-(val & mask) + (val & ~mask));
}
/*
diff --git a/usr/src/lib/libshare/common/libshare.c b/usr/src/lib/libshare/common/libshare.c
index 320ff911d7..6950031978 100644
--- a/usr/src/lib/libshare/common/libshare.c
+++ b/usr/src/lib/libshare/common/libshare.c
@@ -44,6 +44,7 @@
#include <libintl.h>
#include <thread.h>
#include <synch.h>
+#include <errno.h>
#define DFS_LOCK_FILE "/etc/dfs/fstypes"
#define SA_STRSIZE 256 /* max string size for names */
@@ -879,7 +880,6 @@ sa_init(int init_service)
sablocksigs(&old);
lockfd = open(DFS_LOCK_FILE, O_RDWR);
if (lockfd >= 0) {
- extern int errno;
errno = 0;
(void) lockf(lockfd, F_LOCK, 0);
(void) mutex_lock(&sa_dfstab_lock);
diff --git a/usr/src/uts/common/io/mac/mac_provider.c b/usr/src/uts/common/io/mac/mac_provider.c
index 98b770786a..beb63937ed 100644
--- a/usr/src/uts/common/io/mac/mac_provider.c
+++ b/usr/src/uts/common/io/mac/mac_provider.c
@@ -22,6 +22,7 @@
/*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2015, Joyent, Inc.
+ * Copyright 2017 OmniTI Computer Consulting, Inc. All rights reserved.
*/
#include <sys/types.h>
@@ -518,6 +519,18 @@ mac_unregister(mac_handle_t mh)
*/
i_mac_notify_exit(mip);
+ /*
+ * Prior to acquiring the MAC perimeter, remove the MAC instance from
+ * the internal hash table. Such removal means table-walkers that
+ * acquire the perimeter will not do so on behalf of what we are
+ * unregistering, which prevents a deadlock.
+ */
+ rw_enter(&i_mac_impl_lock, RW_WRITER);
+ (void) mod_hash_remove(i_mac_impl_hash,
+ (mod_hash_key_t)mip->mi_name, &val);
+ rw_exit(&i_mac_impl_lock);
+ ASSERT(mip == (mac_impl_t *)val);
+
i_mac_perim_enter(mip);
/*
@@ -537,10 +550,6 @@ mac_unregister(mac_handle_t mh)
mac_driver_stat_delete(mip);
- (void) mod_hash_remove(i_mac_impl_hash,
- (mod_hash_key_t)mip->mi_name, &val);
- ASSERT(mip == (mac_impl_t *)val);
-
ASSERT(i_mac_impl_count > 0);
atomic_dec_32(&i_mac_impl_count);
diff --git a/usr/src/uts/common/io/scsi/targets/sd.c b/usr/src/uts/common/io/scsi/targets/sd.c
index f0864d98b0..bf0f2dca12 100644
--- a/usr/src/uts/common/io/scsi/targets/sd.c
+++ b/usr/src/uts/common/io/scsi/targets/sd.c
@@ -1252,7 +1252,6 @@ static void sd_register_devid(sd_ssc_t *ssc, dev_info_t *devi,
static int sd_get_devid(sd_ssc_t *ssc);
static ddi_devid_t sd_create_devid(sd_ssc_t *ssc);
static int sd_write_deviceid(sd_ssc_t *ssc);
-static int sd_get_devid_page(struct sd_lun *un, uchar_t *wwn, int *len);
static int sd_check_vpd_page_support(sd_ssc_t *ssc);
static void sd_setup_pm(sd_ssc_t *ssc, dev_info_t *devi);
@@ -1638,15 +1637,15 @@ static void sd_check_for_writable_cd(sd_ssc_t *ssc, int path_flag);
static int sd_wm_cache_constructor(void *wm, void *un, int flags);
static void sd_wm_cache_destructor(void *wm, void *un);
static struct sd_w_map *sd_range_lock(struct sd_lun *un, daddr_t startb,
- daddr_t endb, ushort_t typ);
+ daddr_t endb, ushort_t typ);
static struct sd_w_map *sd_get_range(struct sd_lun *un, daddr_t startb,
- daddr_t endb);
+ daddr_t endb);
static void sd_free_inlist_wmap(struct sd_lun *un, struct sd_w_map *wmp);
static void sd_range_unlock(struct sd_lun *un, struct sd_w_map *wm);
static void sd_read_modify_write_task(void * arg);
static int
sddump_do_read_of_rmw(struct sd_lun *un, uint64_t blkno, uint64_t nblk,
- struct buf **bpp);
+ struct buf **bpp);
/*
@@ -2885,7 +2884,7 @@ sdinfo(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result)
static int
sd_prop_op(dev_t dev, dev_info_t *dip, ddi_prop_op_t prop_op, int mod_flags,
- char *name, caddr_t valuep, int *lengthp)
+ char *name, caddr_t valuep, int *lengthp)
{
struct sd_lun *un;
@@ -5012,7 +5011,7 @@ sd_is_lsi(struct sd_lun *un)
static int
sd_get_physical_geometry(struct sd_lun *un, cmlb_geom_t *pgeom_p,
- diskaddr_t capacity, int lbasize, int path_flag)
+ diskaddr_t capacity, int lbasize, int path_flag)
{
struct mode_format *page3p;
struct mode_geometry *page4p;
@@ -6705,12 +6704,12 @@ sdpower(dev_info_t *devi, int component, int level)
int medium_present;
time_t intvlp;
struct pm_trans_data sd_pm_tran_data;
- uchar_t save_state;
+ uchar_t save_state = SD_STATE_NORMAL;
int sval, tursval;
uchar_t state_before_pm;
int got_semaphore_here;
sd_ssc_t *ssc;
- int last_power_level;
+ int last_power_level = SD_SPINDLE_UNINIT;
instance = ddi_get_instance(devi);
@@ -8497,8 +8496,6 @@ sd_unit_attach(dev_info_t *devi)
*/
wm_cache_failed:
devid_failed:
-
-setup_pm_failed:
ddi_remove_minor_node(devi, NULL);
cmlb_attach_failed:
@@ -8617,8 +8614,6 @@ create_errstats_failed:
sema_destroy(&un->un_semoclose);
cv_destroy(&un->un_state_cv);
-getrbuf_failed:
-
sd_free_rqs(un);
alloc_rqs_failed:
@@ -8626,7 +8621,6 @@ alloc_rqs_failed:
devp->sd_private = NULL;
bzero(un, sizeof (struct sd_lun)); /* Clear any stale data! */
-get_softstate_failed:
/*
* Note: the man pages are unclear as to whether or not doing a
* ddi_soft_state_free(sd_state, instance) is the right way to
@@ -11657,7 +11651,7 @@ sd_xbuf_strategy(struct buf *bp, ddi_xbuf_t xp, void *arg)
static void
sd_xbuf_init(struct sd_lun *un, struct buf *bp, struct sd_xbuf *xp,
- uchar_t chain_type, void *pktinfop)
+ uchar_t chain_type, void *pktinfop)
{
int index;
@@ -11891,7 +11885,7 @@ sd_uscsi_strategy(struct buf *bp)
static int
sd_send_scsi_cmd(dev_t dev, struct uscsi_cmd *incmd, int flag,
- enum uio_seg dataspace, int path_flag)
+ enum uio_seg dataspace, int path_flag)
{
struct sd_lun *un;
sd_ssc_t *ssc;
@@ -12061,7 +12055,7 @@ sd_ssc_fini(sd_ssc_t *ssc)
*/
static int
sd_ssc_send(sd_ssc_t *ssc, struct uscsi_cmd *incmd, int flag,
- enum uio_seg dataspace, int path_flag)
+ enum uio_seg dataspace, int path_flag)
{
struct sd_uscsi_info *uip;
struct uscsi_cmd *uscmd;
@@ -14447,8 +14441,8 @@ sd_destroypkt_for_uscsi(struct buf *bp)
*/
static struct buf *
-sd_bioclone_alloc(struct buf *bp, size_t datalen,
- daddr_t blkno, int (*func)(struct buf *))
+sd_bioclone_alloc(struct buf *bp, size_t datalen, daddr_t blkno,
+ int (*func)(struct buf *))
{
struct sd_lun *un;
struct sd_xbuf *xp;
@@ -14507,7 +14501,7 @@ sd_bioclone_alloc(struct buf *bp, size_t datalen,
static struct buf *
sd_shadow_buf_alloc(struct buf *bp, size_t datalen, uint_t bflags,
- daddr_t blkno, int (*func)(struct buf *))
+ daddr_t blkno, int (*func)(struct buf *))
{
struct sd_lun *un;
struct sd_xbuf *xp;
@@ -14664,7 +14658,7 @@ sd_shadow_buf_free(struct buf *bp)
static void
sd_print_transport_rejected_message(struct sd_lun *un, struct sd_xbuf *xp,
- int code)
+ int code)
{
ASSERT(un != NULL);
ASSERT(mutex_owned(SD_MUTEX(un)));
@@ -15623,7 +15617,7 @@ sd_return_failed_command(struct sd_lun *un, struct buf *bp, int errcode)
static void
sd_return_failed_command_no_restart(struct sd_lun *un, struct buf *bp,
- int errcode)
+ int errcode)
{
struct sd_xbuf *xp;
@@ -15734,9 +15728,9 @@ sd_return_failed_command_no_restart(struct sd_lun *un, struct buf *bp,
static void
sd_retry_command(struct sd_lun *un, struct buf *bp, int retry_check_flag,
- void (*user_funcp)(struct sd_lun *un, struct buf *bp, void *argp, int
- code), void *user_arg, int failure_code, clock_t retry_delay,
- void (*statp)(kstat_io_t *))
+ void (*user_funcp)(struct sd_lun *un, struct buf *bp, void *argp, int code),
+ void *user_arg, int failure_code, clock_t retry_delay,
+ void (*statp)(kstat_io_t *))
{
struct sd_xbuf *xp;
struct scsi_pkt *pktp;
@@ -16100,7 +16094,7 @@ fail_command_no_log:
static void
sd_set_retry_bp(struct sd_lun *un, struct buf *bp, clock_t retry_delay,
- void (*statp)(kstat_io_t *))
+ void (*statp)(kstat_io_t *))
{
ASSERT(un != NULL);
ASSERT(mutex_owned(SD_MUTEX(un)));
@@ -16351,7 +16345,7 @@ sd_start_direct_priority_command(void *arg)
static void
sd_send_request_sense_command(struct sd_lun *un, struct buf *bp,
- struct scsi_pkt *pktp)
+ struct scsi_pkt *pktp)
{
ASSERT(bp != NULL);
ASSERT(un != NULL);
@@ -17398,7 +17392,7 @@ sd_print_incomplete_msg(struct sd_lun *un, struct buf *bp, void *arg, int code)
static void
sd_pkt_status_good(struct sd_lun *un, struct buf *bp,
- struct sd_xbuf *xp, struct scsi_pkt *pktp)
+ struct sd_xbuf *xp, struct scsi_pkt *pktp)
{
char *cmdp;
@@ -17458,7 +17452,7 @@ sd_pkt_status_good(struct sd_lun *un, struct buf *bp,
static void
sd_handle_request_sense(struct sd_lun *un, struct buf *sense_bp,
- struct sd_xbuf *sense_xp, struct scsi_pkt *sense_pktp)
+ struct sd_xbuf *sense_xp, struct scsi_pkt *sense_pktp)
{
struct buf *cmd_bp; /* buf for the original command */
struct sd_xbuf *cmd_xp; /* sd_xbuf for the original command */
@@ -17578,7 +17572,7 @@ sd_handle_request_sense(struct sd_lun *un, struct buf *sense_bp,
static void
sd_handle_auto_request_sense(struct sd_lun *un, struct buf *bp,
- struct sd_xbuf *xp, struct scsi_pkt *pktp)
+ struct sd_xbuf *xp, struct scsi_pkt *pktp)
{
struct scsi_arq_status *asp;
size_t actual_len;
@@ -17668,7 +17662,7 @@ sd_handle_auto_request_sense(struct sd_lun *un, struct buf *bp,
static void
sd_print_sense_failed_msg(struct sd_lun *un, struct buf *bp, void *arg,
- int code)
+ int code)
{
char *msgp = arg;
@@ -17697,7 +17691,7 @@ sd_print_sense_failed_msg(struct sd_lun *un, struct buf *bp, void *arg,
static int
sd_validate_sense_data(struct sd_lun *un, struct buf *bp, struct sd_xbuf *xp,
- size_t actual_len)
+ size_t actual_len)
{
struct scsi_extended_sense *esp;
struct scsi_pkt *pktp;
@@ -17866,7 +17860,7 @@ sense_failed:
static void
sd_decode_sense(struct sd_lun *un, struct buf *bp, struct sd_xbuf *xp,
- struct scsi_pkt *pktp)
+ struct scsi_pkt *pktp)
{
uint8_t sense_key;
@@ -18168,8 +18162,8 @@ sd_print_sense_msg(struct sd_lun *un, struct buf *bp, void *arg, int code)
*/
static void
-sd_sense_key_no_sense(struct sd_lun *un, struct buf *bp,
- struct sd_xbuf *xp, struct scsi_pkt *pktp)
+sd_sense_key_no_sense(struct sd_lun *un, struct buf *bp, struct sd_xbuf *xp,
+ struct scsi_pkt *pktp)
{
struct sd_sense_info si;
@@ -18198,9 +18192,8 @@ sd_sense_key_no_sense(struct sd_lun *un, struct buf *bp,
*/
static void
-sd_sense_key_recoverable_error(struct sd_lun *un,
- uint8_t *sense_datap,
- struct buf *bp, struct sd_xbuf *xp, struct scsi_pkt *pktp)
+sd_sense_key_recoverable_error(struct sd_lun *un, uint8_t *sense_datap,
+ struct buf *bp, struct sd_xbuf *xp, struct scsi_pkt *pktp)
{
struct sd_sense_info si;
uint8_t asc = scsi_sense_asc(sense_datap);
@@ -18256,9 +18249,8 @@ sd_sense_key_recoverable_error(struct sd_lun *un,
*/
static void
-sd_sense_key_not_ready(struct sd_lun *un,
- uint8_t *sense_datap,
- struct buf *bp, struct sd_xbuf *xp, struct scsi_pkt *pktp)
+sd_sense_key_not_ready(struct sd_lun *un, uint8_t *sense_datap, struct buf *bp,
+ struct sd_xbuf *xp, struct scsi_pkt *pktp)
{
struct sd_sense_info si;
uint8_t asc = scsi_sense_asc(sense_datap);
@@ -18527,9 +18519,8 @@ fail_command:
*/
static void
-sd_sense_key_medium_or_hardware_error(struct sd_lun *un,
- uint8_t *sense_datap,
- struct buf *bp, struct sd_xbuf *xp, struct scsi_pkt *pktp)
+sd_sense_key_medium_or_hardware_error(struct sd_lun *un, uint8_t *sense_datap,
+ struct buf *bp, struct sd_xbuf *xp, struct scsi_pkt *pktp)
{
struct sd_sense_info si;
uint8_t sense_key = scsi_sense_key(sense_datap);
@@ -18625,7 +18616,7 @@ sd_sense_key_medium_or_hardware_error(struct sd_lun *un,
static void
sd_sense_key_illegal_request(struct sd_lun *un, struct buf *bp,
- struct sd_xbuf *xp, struct scsi_pkt *pktp)
+ struct sd_xbuf *xp, struct scsi_pkt *pktp)
{
struct sd_sense_info si;
@@ -18657,9 +18648,8 @@ sd_sense_key_illegal_request(struct sd_lun *un, struct buf *bp,
*/
static void
-sd_sense_key_unit_attention(struct sd_lun *un,
- uint8_t *sense_datap,
- struct buf *bp, struct sd_xbuf *xp, struct scsi_pkt *pktp)
+sd_sense_key_unit_attention(struct sd_lun *un, uint8_t *sense_datap,
+ struct buf *bp, struct sd_xbuf *xp, struct scsi_pkt *pktp)
{
/*
* For UNIT ATTENTION we allow retries for one minute. Devices
@@ -18810,8 +18800,8 @@ do_retry:
*/
static void
-sd_sense_key_fail_command(struct sd_lun *un, struct buf *bp,
- struct sd_xbuf *xp, struct scsi_pkt *pktp)
+sd_sense_key_fail_command(struct sd_lun *un, struct buf *bp, struct sd_xbuf *xp,
+ struct scsi_pkt *pktp)
{
struct sd_sense_info si;
@@ -18840,8 +18830,8 @@ sd_sense_key_fail_command(struct sd_lun *un, struct buf *bp,
*/
static void
-sd_sense_key_blank_check(struct sd_lun *un, struct buf *bp,
- struct sd_xbuf *xp, struct scsi_pkt *pktp)
+sd_sense_key_blank_check(struct sd_lun *un, struct buf *bp, struct sd_xbuf *xp,
+ struct scsi_pkt *pktp)
{
struct sd_sense_info si;
@@ -18876,7 +18866,7 @@ sd_sense_key_blank_check(struct sd_lun *un, struct buf *bp,
static void
sd_sense_key_aborted_command(struct sd_lun *un, struct buf *bp,
- struct sd_xbuf *xp, struct scsi_pkt *pktp)
+ struct sd_xbuf *xp, struct scsi_pkt *pktp)
{
struct sd_sense_info si;
@@ -18911,9 +18901,8 @@ sd_sense_key_aborted_command(struct sd_lun *un, struct buf *bp,
*/
static void
-sd_sense_key_default(struct sd_lun *un,
- uint8_t *sense_datap,
- struct buf *bp, struct sd_xbuf *xp, struct scsi_pkt *pktp)
+sd_sense_key_default(struct sd_lun *un, uint8_t *sense_datap, struct buf *bp,
+ struct sd_xbuf *xp, struct scsi_pkt *pktp)
{
struct sd_sense_info si;
uint8_t sense_key = scsi_sense_key(sense_datap);
@@ -19044,7 +19033,7 @@ update_pkt_reason:
static void
sd_print_cmd_incomplete_msg(struct sd_lun *un, struct buf *bp, void *arg,
- int code)
+ int code)
{
dev_info_t *dip;
@@ -19092,7 +19081,7 @@ sd_print_cmd_incomplete_msg(struct sd_lun *un, struct buf *bp, void *arg,
static void
sd_pkt_reason_cmd_incomplete(struct sd_lun *un, struct buf *bp,
- struct sd_xbuf *xp, struct scsi_pkt *pktp)
+ struct sd_xbuf *xp, struct scsi_pkt *pktp)
{
int flag = SD_RETRIES_STANDARD | SD_RETRIES_ISOLATE;
@@ -19137,7 +19126,7 @@ sd_pkt_reason_cmd_incomplete(struct sd_lun *un, struct buf *bp,
static void
sd_pkt_reason_cmd_tran_err(struct sd_lun *un, struct buf *bp,
- struct sd_xbuf *xp, struct scsi_pkt *pktp)
+ struct sd_xbuf *xp, struct scsi_pkt *pktp)
{
ASSERT(un != NULL);
ASSERT(mutex_owned(SD_MUTEX(un)));
@@ -19174,8 +19163,8 @@ sd_pkt_reason_cmd_tran_err(struct sd_lun *un, struct buf *bp,
*/
static void
-sd_pkt_reason_cmd_reset(struct sd_lun *un, struct buf *bp,
- struct sd_xbuf *xp, struct scsi_pkt *pktp)
+sd_pkt_reason_cmd_reset(struct sd_lun *un, struct buf *bp, struct sd_xbuf *xp,
+ struct scsi_pkt *pktp)
{
ASSERT(un != NULL);
ASSERT(mutex_owned(SD_MUTEX(un)));
@@ -19212,8 +19201,8 @@ sd_pkt_reason_cmd_reset(struct sd_lun *un, struct buf *bp,
*/
static void
-sd_pkt_reason_cmd_aborted(struct sd_lun *un, struct buf *bp,
- struct sd_xbuf *xp, struct scsi_pkt *pktp)
+sd_pkt_reason_cmd_aborted(struct sd_lun *un, struct buf *bp, struct sd_xbuf *xp,
+ struct scsi_pkt *pktp)
{
ASSERT(un != NULL);
ASSERT(mutex_owned(SD_MUTEX(un)));
@@ -19249,8 +19238,8 @@ sd_pkt_reason_cmd_aborted(struct sd_lun *un, struct buf *bp,
*/
static void
-sd_pkt_reason_cmd_timeout(struct sd_lun *un, struct buf *bp,
- struct sd_xbuf *xp, struct scsi_pkt *pktp)
+sd_pkt_reason_cmd_timeout(struct sd_lun *un, struct buf *bp, struct sd_xbuf *xp,
+ struct scsi_pkt *pktp)
{
ASSERT(un != NULL);
ASSERT(mutex_owned(SD_MUTEX(un)));
@@ -19286,7 +19275,7 @@ sd_pkt_reason_cmd_timeout(struct sd_lun *un, struct buf *bp,
static void
sd_pkt_reason_cmd_unx_bus_free(struct sd_lun *un, struct buf *bp,
- struct sd_xbuf *xp, struct scsi_pkt *pktp)
+ struct sd_xbuf *xp, struct scsi_pkt *pktp)
{
void (*funcp)(struct sd_lun *un, struct buf *bp, void *arg, int code);
@@ -19317,7 +19306,7 @@ sd_pkt_reason_cmd_unx_bus_free(struct sd_lun *un, struct buf *bp,
static void
sd_pkt_reason_cmd_tag_reject(struct sd_lun *un, struct buf *bp,
- struct sd_xbuf *xp, struct scsi_pkt *pktp)
+ struct sd_xbuf *xp, struct scsi_pkt *pktp)
{
ASSERT(un != NULL);
ASSERT(mutex_owned(SD_MUTEX(un)));
@@ -19355,8 +19344,8 @@ sd_pkt_reason_cmd_tag_reject(struct sd_lun *un, struct buf *bp,
*/
static void
-sd_pkt_reason_default(struct sd_lun *un, struct buf *bp,
- struct sd_xbuf *xp, struct scsi_pkt *pktp)
+sd_pkt_reason_default(struct sd_lun *un, struct buf *bp, struct sd_xbuf *xp,
+ struct scsi_pkt *pktp)
{
ASSERT(un != NULL);
ASSERT(mutex_owned(SD_MUTEX(un)));
@@ -19385,7 +19374,7 @@ sd_pkt_reason_default(struct sd_lun *un, struct buf *bp,
static void
sd_pkt_status_check_condition(struct sd_lun *un, struct buf *bp,
- struct sd_xbuf *xp, struct scsi_pkt *pktp)
+ struct sd_xbuf *xp, struct scsi_pkt *pktp)
{
ASSERT(un != NULL);
ASSERT(mutex_owned(SD_MUTEX(un)));
@@ -19437,7 +19426,7 @@ sd_pkt_status_check_condition(struct sd_lun *un, struct buf *bp,
static void
sd_pkt_status_busy(struct sd_lun *un, struct buf *bp, struct sd_xbuf *xp,
- struct scsi_pkt *pktp)
+ struct scsi_pkt *pktp)
{
ASSERT(un != NULL);
ASSERT(mutex_owned(SD_MUTEX(un)));
@@ -19531,7 +19520,7 @@ sd_pkt_status_busy(struct sd_lun *un, struct buf *bp, struct sd_xbuf *xp,
static void
sd_pkt_status_reservation_conflict(struct sd_lun *un, struct buf *bp,
- struct sd_xbuf *xp, struct scsi_pkt *pktp)
+ struct sd_xbuf *xp, struct scsi_pkt *pktp)
{
ASSERT(un != NULL);
ASSERT(mutex_owned(SD_MUTEX(un)));
@@ -19612,8 +19601,8 @@ sd_pkt_status_reservation_conflict(struct sd_lun *un, struct buf *bp,
*/
static void
-sd_pkt_status_qfull(struct sd_lun *un, struct buf *bp,
- struct sd_xbuf *xp, struct scsi_pkt *pktp)
+sd_pkt_status_qfull(struct sd_lun *un, struct buf *bp, struct sd_xbuf *xp,
+ struct scsi_pkt *pktp)
{
ASSERT(un != NULL);
ASSERT(mutex_owned(SD_MUTEX(un)));
@@ -20131,7 +20120,7 @@ sd_send_scsi_DOORLOCK(sd_ssc_t *ssc, int flag, int path_flag)
static int
sd_send_scsi_READ_CAPACITY(sd_ssc_t *ssc, uint64_t *capp, uint32_t *lbap,
- int path_flag)
+ int path_flag)
{
struct scsi_extended_sense sense_buf;
struct uscsi_cmd ucmd_buf;
@@ -20348,8 +20337,8 @@ rc16_done:
#define SD_CAPACITY_16_SIZE sizeof (struct scsi_capacity_16)
static int
-sd_send_scsi_READ_CAPACITY_16(sd_ssc_t *ssc, uint64_t *capp,
- uint32_t *lbap, uint32_t *psp, int path_flag)
+sd_send_scsi_READ_CAPACITY_16(sd_ssc_t *ssc, uint64_t *capp, uint32_t *lbap,
+ uint32_t *psp, int path_flag)
{
struct scsi_extended_sense sense_buf;
struct uscsi_cmd ucmd_buf;
@@ -20802,7 +20791,7 @@ sd_start_stop_unit_task(void *arg)
static int
sd_send_scsi_INQUIRY(sd_ssc_t *ssc, uchar_t *bufaddr, size_t buflen,
- uchar_t evpd, uchar_t page_code, size_t *residp)
+ uchar_t evpd, uchar_t page_code, size_t *residp)
{
union scsi_cdb cdb;
struct uscsi_cmd ucmd_buf;
@@ -20992,8 +20981,8 @@ sd_send_scsi_TEST_UNIT_READY(sd_ssc_t *ssc, int flag)
*/
static int
-sd_send_scsi_PERSISTENT_RESERVE_IN(sd_ssc_t *ssc, uchar_t usr_cmd,
- uint16_t data_len, uchar_t *data_bufp)
+sd_send_scsi_PERSISTENT_RESERVE_IN(sd_ssc_t *ssc, uchar_t usr_cmd,
+ uint16_t data_len, uchar_t *data_bufp)
{
struct scsi_extended_sense sense_buf;
union scsi_cdb cdb;
@@ -21100,7 +21089,7 @@ sd_send_scsi_PERSISTENT_RESERVE_IN(sd_ssc_t *ssc, uchar_t usr_cmd,
static int
sd_send_scsi_PERSISTENT_RESERVE_OUT(sd_ssc_t *ssc, uchar_t usr_cmd,
- uchar_t *usr_bufp)
+ uchar_t *usr_bufp)
{
struct scsi_extended_sense sense_buf;
union scsi_cdb cdb;
@@ -21519,8 +21508,8 @@ done:
static int
sd_send_scsi_GET_CONFIGURATION(sd_ssc_t *ssc, struct uscsi_cmd *ucmdbuf,
- uchar_t *rqbuf, uint_t rqbuflen, uchar_t *bufaddr, uint_t buflen,
- int path_flag)
+ uchar_t *rqbuf, uint_t rqbuflen, uchar_t *bufaddr, uint_t buflen,
+ int path_flag)
{
char cdb[CDB_GROUP1];
int status;
@@ -21610,9 +21599,9 @@ sd_send_scsi_GET_CONFIGURATION(sd_ssc_t *ssc, struct uscsi_cmd *ucmdbuf,
*
*/
static int
-sd_send_scsi_feature_GET_CONFIGURATION(sd_ssc_t *ssc,
- struct uscsi_cmd *ucmdbuf, uchar_t *rqbuf, uint_t rqbuflen,
- uchar_t *bufaddr, uint_t buflen, char feature, int path_flag)
+sd_send_scsi_feature_GET_CONFIGURATION(sd_ssc_t *ssc, struct uscsi_cmd *ucmdbuf,
+ uchar_t *rqbuf, uint_t rqbuflen, uchar_t *bufaddr, uint_t buflen,
+ char feature, int path_flag)
{
char cdb[CDB_GROUP1];
int status;
@@ -21711,7 +21700,7 @@ sd_send_scsi_feature_GET_CONFIGURATION(sd_ssc_t *ssc,
static int
sd_send_scsi_MODE_SENSE(sd_ssc_t *ssc, int cdbsize, uchar_t *bufaddr,
- size_t buflen, uchar_t page_code, int path_flag)
+ size_t buflen, uchar_t page_code, int path_flag)
{
struct scsi_extended_sense sense_buf;
union scsi_cdb cdb;
@@ -21829,7 +21818,7 @@ sd_send_scsi_MODE_SENSE(sd_ssc_t *ssc, int cdbsize, uchar_t *bufaddr,
static int
sd_send_scsi_MODE_SELECT(sd_ssc_t *ssc, int cdbsize, uchar_t *bufaddr,
- size_t buflen, uchar_t save_page, int path_flag)
+ size_t buflen, uchar_t save_page, int path_flag)
{
struct scsi_extended_sense sense_buf;
union scsi_cdb cdb;
@@ -21936,7 +21925,7 @@ sd_send_scsi_MODE_SELECT(sd_ssc_t *ssc, int cdbsize, uchar_t *bufaddr,
static int
sd_send_scsi_RDWR(sd_ssc_t *ssc, uchar_t cmd, void *bufaddr,
- size_t buflen, daddr_t start_block, int path_flag)
+ size_t buflen, daddr_t start_block, int path_flag)
{
struct scsi_extended_sense sense_buf;
union scsi_cdb cdb;
@@ -22063,9 +22052,7 @@ sd_send_scsi_RDWR(sd_ssc_t *ssc, uchar_t cmd, void *bufaddr,
static int
sd_send_scsi_LOG_SENSE(sd_ssc_t *ssc, uchar_t *bufaddr, uint16_t buflen,
- uchar_t page_code, uchar_t page_control, uint16_t param_ptr,
- int path_flag)
-
+ uchar_t page_code, uchar_t page_control, uint16_t param_ptr, int path_flag)
{
struct scsi_extended_sense sense_buf;
union scsi_cdb cdb;
@@ -22113,7 +22100,7 @@ sd_send_scsi_LOG_SENSE(sd_ssc_t *ssc, uchar_t *bufaddr, uint16_t buflen,
case STATUS_CHECK:
if ((ucmd_buf.uscsi_rqstatus == STATUS_GOOD) &&
(scsi_sense_key((uint8_t *)&sense_buf) ==
- KEY_ILLEGAL_REQUEST) &&
+ KEY_ILLEGAL_REQUEST) &&
(scsi_sense_asc((uint8_t *)&sense_buf) == 0x24)) {
/*
* ASC 0x24: INVALID FIELD IN CDB
@@ -22197,7 +22184,7 @@ sd_send_scsi_LOG_SENSE(sd_ssc_t *ssc, uchar_t *bufaddr, uint16_t buflen,
static int
sd_send_scsi_GET_EVENT_STATUS_NOTIFICATION(sd_ssc_t *ssc, uchar_t *bufaddr,
- size_t buflen, uchar_t class_req)
+ size_t buflen, uchar_t class_req)
{
union scsi_cdb cdb;
struct uscsi_cmd ucmd_buf;
@@ -22533,9 +22520,9 @@ skip_ready_valid:
if ((err == 0) &&
((cmd == DKIOCSETEFI) ||
- (un->un_f_pkstats_enabled) &&
+ ((un->un_f_pkstats_enabled) &&
(cmd == DKIOCSAPART || cmd == DKIOCSVTOC ||
- cmd == DKIOCSEXTVTOC))) {
+ cmd == DKIOCSEXTVTOC)))) {
tmprval = cmlb_validate(un->un_cmlbhandle, CMLB_SILENT,
(void *)SD_PATH_DIRECT);
@@ -23521,7 +23508,7 @@ sd_dkio_ctrl_info(dev_t dev, caddr_t arg, int flag)
*/
static int
sd_get_media_info_com(dev_t dev, uint_t *dki_media_type, uint_t *dki_lbsize,
- diskaddr_t *dki_capacity, uint_t *dki_pbsize)
+ diskaddr_t *dki_capacity, uint_t *dki_pbsize)
{
struct sd_lun *un = NULL;
struct uscsi_cmd com;
@@ -26102,8 +26089,7 @@ sddump(dev_t dev, caddr_t addr, daddr_t blkno, int nblk)
((uint64_t)(blkno * un->un_sys_blocksize)) -
((uint64_t)(tgt_blkno * un->un_tgt_blocksize));
- ASSERT((io_start_offset >= 0) &&
- (io_start_offset < un->un_tgt_blocksize));
+ ASSERT(io_start_offset < un->un_tgt_blocksize);
/*
* Do the modify portion of read modify write.
*/
@@ -26665,10 +26651,10 @@ sd_persistent_reservation_in_read_keys(struct sd_lun *un,
sd_prin_readkeys_t *in;
mhioc_inkeys_t *ptr;
mhioc_key_list_t li;
- uchar_t *data_bufp;
- int data_len;
+ uchar_t *data_bufp = NULL;
+ int data_len = 0;
int rval = 0;
- size_t copysz;
+ size_t copysz = 0;
sd_ssc_t *ssc;
if ((ptr = (mhioc_inkeys_t *)usrp) == NULL) {
@@ -26682,7 +26668,6 @@ sd_persistent_reservation_in_read_keys(struct sd_lun *un,
* Get the listsize from user
*/
#ifdef _MULTI_DATAMODEL
-
switch (ddi_model_convert_from(flag & FMODELS)) {
case DDI_MODEL_ILP32:
copysz = sizeof (struct mhioc_key_list32);
@@ -26832,7 +26817,7 @@ sd_persistent_reservation_in_read_resv(struct sd_lun *un,
int data_len;
int rval = 0;
int i;
- size_t copysz;
+ size_t copysz = 0;
mhioc_resv_desc_t *bufp;
sd_ssc_t *ssc;
@@ -29544,8 +29529,9 @@ sd_range_lock(struct sd_lun *un, daddr_t startb, daddr_t endb, ushort_t typ)
*/
ASSERT(!(sl_wmp->wm_flags & SD_WM_BUSY));
if (sl_wmp->wm_wanted_count == 0) {
- if (wmp != NULL)
+ if (wmp != NULL) {
CHK_N_FREEWMP(un, wmp);
+ }
wmp = sl_wmp;
}
sl_wmp = NULL;
@@ -29751,7 +29737,7 @@ sd_read_modify_write_task(void *arg)
static int
sddump_do_read_of_rmw(struct sd_lun *un, uint64_t blkno, uint64_t nblk,
- struct buf **bpp)
+ struct buf **bpp)
{
int err;
int i;
@@ -30182,8 +30168,8 @@ static uint_t sd_fault_injection_on = 0;
*/
static void
-sd_faultinjection_ioctl(int cmd, intptr_t arg, struct sd_lun *un) {
-
+sd_faultinjection_ioctl(int cmd, intptr_t arg, struct sd_lun *un)
+{
uint_t i = 0;
uint_t rval;
@@ -30450,8 +30436,7 @@ sd_faultinjection_ioctl(int cmd, intptr_t arg, struct sd_lun *un) {
}
mutex_exit(SD_MUTEX(un));
- SD_TRACE(SD_LOG_IOERR, un, "sd_faultinjection_ioctl:"
- " exit\n");
+ SD_TRACE(SD_LOG_IOERR, un, "sd_faultinjection_ioctl: exit\n");
}
diff --git a/usr/src/uts/common/io/scsi/targets/sd_xbuf.c b/usr/src/uts/common/io/scsi/targets/sd_xbuf.c
index 792a5f717c..be464d657c 100644
--- a/usr/src/uts/common/io/scsi/targets/sd_xbuf.c
+++ b/usr/src/uts/common/io/scsi/targets/sd_xbuf.c
@@ -53,7 +53,6 @@
static int xbuf_iostart(ddi_xbuf_attr_t xap);
static void xbuf_dispatch(ddi_xbuf_attr_t xap);
static void xbuf_restart_callback(void *arg);
-static void xbuf_enqueue(struct buf *bp, ddi_xbuf_attr_t xap);
static int xbuf_brk_done(struct buf *bp);
@@ -106,9 +105,9 @@ _NOTE(DATA_READABLE_WITHOUT_LOCK(xbuf_brk::off))
/* ARGSUSED */
DDII ddi_xbuf_attr_t
ddi_xbuf_attr_create(size_t xsize,
- void (*xa_strategy)(struct buf *bp, ddi_xbuf_t xp, void *attr_arg),
- void *attr_arg, uint32_t active_limit, uint32_t reserve_limit,
- major_t major, int flags)
+ void (*xa_strategy)(struct buf *bp, ddi_xbuf_t xp, void *attr_arg),
+ void *attr_arg, uint32_t active_limit, uint32_t reserve_limit,
+ major_t major, int flags)
{
ddi_xbuf_attr_t xap;
diff --git a/usr/src/uts/common/netinet/in.h b/usr/src/uts/common/netinet/in.h
index 7927cf5e24..220537601a 100644
--- a/usr/src/uts/common/netinet/in.h
+++ b/usr/src/uts/common/netinet/in.h
@@ -118,9 +118,11 @@ struct in6_addr {
*/
#ifdef _KERNEL
uint32_t _S6_u32[4]; /* IPv6 address */
+ uint16_t _S6_u16[8]; /* IPv6 address */
uint8_t _S6_u8[16]; /* IPv6 address */
#else
uint8_t _S6_u8[16]; /* IPv6 address */
+ uint16_t _S6_u16[8]; /* IPv6 address */
uint32_t _S6_u32[4]; /* IPv6 address */
#endif
uint32_t __S6_align; /* Align on 32 bit boundary */
@@ -130,6 +132,7 @@ struct in6_addr {
#ifdef _KERNEL
#define s6_addr8 _S6_un._S6_u8
+#define s6_addr16 _S6_un._S6_u16
#define s6_addr32 _S6_un._S6_u32
#endif
diff --git a/usr/src/uts/i86pc/i86hvm/hvm_sd/Makefile b/usr/src/uts/i86pc/i86hvm/hvm_sd/Makefile
index aba7418b0a..f5dc7a922a 100644
--- a/usr/src/uts/i86pc/i86hvm/hvm_sd/Makefile
+++ b/usr/src/uts/i86pc/i86hvm/hvm_sd/Makefile
@@ -70,13 +70,6 @@ LINTTAGS += -erroff=E_STATIC_UNUSED
LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW
LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV
-CERRWARN += -_gcc=-Wno-unused-function
-CERRWARN += -_gcc=-Wno-unused-label
-CERRWARN += -_gcc=-Wno-parentheses
-CERRWARN += -_gcc=-Wno-type-limits
-CERRWARN += -_gcc=-Wno-uninitialized
-CERRWARN += -_gcc=-Wno-unused-value
-
#
# Depends on scsi and cmlb
#
diff --git a/usr/src/uts/intel/sd/Makefile b/usr/src/uts/intel/sd/Makefile
index 42af2b7225..90e10840c1 100644
--- a/usr/src/uts/intel/sd/Makefile
+++ b/usr/src/uts/intel/sd/Makefile
@@ -77,13 +77,6 @@ LINTTAGS += -erroff=E_STATIC_UNUSED
LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW
LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV
-CERRWARN += -_gcc=-Wno-unused-variable
-CERRWARN += -_gcc=-Wno-unused-function
-CERRWARN += -_gcc=-Wno-unused-label
-CERRWARN += -_gcc=-Wno-parentheses
-CERRWARN += -_gcc=-Wno-type-limits
-CERRWARN += -_gcc=-Wno-uninitialized
-
#
# Depends on scsi and cmlb
#
diff --git a/usr/src/uts/sparc/sd/Makefile b/usr/src/uts/sparc/sd/Makefile
index 08d2efc031..ea74399df4 100644
--- a/usr/src/uts/sparc/sd/Makefile
+++ b/usr/src/uts/sparc/sd/Makefile
@@ -79,13 +79,6 @@ LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV
LINTTAGS += -erroff=E_STATIC_UNUSED
LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON
-CERRWARN += -_gcc=-Wno-unused-variable
-CERRWARN += -_gcc=-Wno-unused-function
-CERRWARN += -_gcc=-Wno-unused-label
-CERRWARN += -_gcc=-Wno-parentheses
-CERRWARN += -_gcc=-Wno-type-limits
-CERRWARN += -_gcc=-Wno-uninitialized
-
#
# Default build targets.
#