changeset 21522:6e9bce32ac09

Merge pull request #502 from citrus-it/smatch Fix smatch warnings
author Dominik Hassler <hadfl@omniosce.org>
date Sun, 23 Jun 2019 08:15:14 +0200
parents f2418e7da5d0 (current diff) 76c8d5c9457c (diff)
children f5ea21f44cc9 7cafa8518480
files
diffstat 3 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/dlmgmtd/dlmgmt_door.c	Wed Jun 19 10:10:57 2019 +0200
+++ b/usr/src/cmd/dlmgmtd/dlmgmt_door.c	Sun Jun 23 08:15:14 2019 +0200
@@ -1368,7 +1368,7 @@
 
 			while ((fd = open(ZONE_LOCK, O_WRONLY |
 			    O_CREAT | O_EXCL, S_IRUSR | S_IWUSR)) < 0)
-			(void) sleep(1);
+				(void) sleep(1);
 			(void) write(fd, my_pid, sizeof (my_pid));
 			(void) close(fd);
 
--- a/usr/src/lib/brand/shared/zadump/zadump.c	Wed Jun 19 10:10:57 2019 +0200
+++ b/usr/src/lib/brand/shared/zadump/zadump.c	Sun Jun 23 08:15:14 2019 +0200
@@ -76,7 +76,7 @@
 
 	if (dladm_datalink_id2info(handle, linkid, NULL, NULL, NULL,
 	    link, sizeof (link)) != DLADM_STATUS_OK)
-		strlcpy(link, "??", MAXLINKNAMELEN);
+		(void) strlcpy(link, "??", MAXLINKNAMELEN);
 	printf(LABEL "%d - %s\n", "Datalink", linkid, link);
 
 	bufsize = sizeof (buf);
--- a/usr/src/uts/common/io/comstar/port/qlt/qlt.c	Wed Jun 19 10:10:57 2019 +0200
+++ b/usr/src/uts/common/io/comstar/port/qlt/qlt.c	Sun Jun 23 08:15:14 2019 +0200
@@ -9488,7 +9488,11 @@
 	bcopy((void *)&time, (void *)&entry->hs_time,
 	    sizeof (timespec_t));
 
-	(void) strcpy(entry->buf, fmt1);
+	/*
+	 * Here we know that fmt1 will fit within QL_LOG_LENGTH due to the
+	 * check above, but smatch identifies a potential problem.
+	 */
+	(void) strncpy(entry->buf, fmt1, rval);
 	entry->buf[rval] = 0;
 
 	TRACE_BUFFER_UNLOCK(qlt);