Miscellaneous ZTS fixes

Coverity had various complaints about minor issues. They are all fairly
straightforward to understand without reading additional files, with the
exception of the draid.c issue. vdev_draid_rand() takes a 128-bit
starting seed, but we were passing a pointer to a 64-bit value, which
understandably made Coverity complain. This is perhaps the only
significant issue fixed in this patch, since it causes stack corruption.

These are not all of the issues in the ZTS that Coverity caught, but a
number of them are already fixed in other PRs. There is also a class of
TOUTOC complaints that involve very minor things in the ZTS (e.g.
access() before unlink()). I have yet to decide whether they are false
positives (since this is not security sensitive code) or something to
cleanup.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Neal Gompa <ngompa@datto.com>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #13943
This commit is contained in:
Richard Yao
2022-09-29 11:56:42 -04:00
committed by GitHub
parent 55c12724d3
commit 570ca4441e
8 changed files with 36 additions and 12 deletions
+2 -2
View File
@@ -53,7 +53,7 @@ static long fsize = FSIZE;
static size_t bsize = BSIZE;
static int count = 0;
static int rflag = 0;
static int seed = 0;
static uint_t seed = 0;
static int vflag = 0;
static int errflag = 0;
static off_t offset = 0;
@@ -105,7 +105,7 @@ parse_options(int argc, char *argv[])
extern int optind, optopt;
count = fsize / bsize;
seed = time(NULL);
seed = (uint_t)time(NULL);
while ((c = getopt(argc, argv, "b:c:f:o:rs:v")) != -1) {
switch (c) {
case 'b':
+5
View File
@@ -152,6 +152,11 @@ main(int argc, char *argv[])
n = strtoull(argv[0], NULL, 0);
fd = open(filename, O_RDWR|O_CREAT, 0666);
if (fd == -1) {
(void) fprintf(stderr, "open(%s) failed: %s\n", filename,
strerror(errno));
exit(EXIT_FAILURE);
}
err = fstat(fd, &ss);
if (err != 0) {
(void) fprintf(stderr,