mirror_zfs/tests/zfs-tests/cmd
Richard Yao 72c99dc959
Handle possible null pointers from malloc/strdup/strndup()
GCC 12.1.1_p20220625's static analyzer caught these.

Of the two in the btree test, one had previously been caught by Coverity
and Smatch, but GCC flagged it as a false positive. Upon examining how
other test cases handle this, the solution was changed from
`ASSERT3P(node, !=, NULL);` to using `perror()` to be consistent with
the fixes to the other fixes done to the ZTS code.

That approach was also used in ZED since I did not see a better way of
handling this there. Also, upon inspection, additional unchecked
pointers from malloc()/calloc()/strdup() were found in ZED, so those
were handled too.

In other parts of the code, the existing methods to avoid issues from
memory allocators returning NULL were used, such as using
`umem_alloc(size, UMEM_NOFAIL)` or returning `ENOMEM`.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #13979
2022-10-06 17:18:40 -07:00
..
checksum Fix BLAKE3 tuneable and module loading on Linux and FreeBSD 2022-09-16 14:25:53 -07:00
file Handle possible null pointers from malloc/strdup/strndup() 2022-10-06 17:18:40 -07:00
linux_dos_attributes tests: cmd: don't recurse 2022-04-01 17:58:23 -07:00
.gitignore Add Linux posix_fadvise support 2022-09-08 10:29:41 -07:00
badsend.c Handle possible null pointers from malloc/strdup/strndup() 2022-10-06 17:18:40 -07:00
btree_test.c Handle possible null pointers from malloc/strdup/strndup() 2022-10-06 17:18:40 -07:00
chg_usr_exec.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
cp_files.c tests: move C test helpers into test cmd 2022-04-01 18:01:39 -07:00
ctime.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
devname2devid.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
dir_rd_update.c Fix unsafe string operations 2022-09-27 16:47:24 -07:00
dosmode_readonly_write.c tests: move C test helpers into test cmd 2022-04-01 18:01:39 -07:00
draid.c Miscellaneous ZTS fixes 2022-09-29 08:56:42 -07:00
ereports.c tests: move C test helpers into test cmd 2022-04-01 18:01:39 -07:00
get_diff.c Miscellaneous ZTS fixes 2022-09-29 08:56:42 -07:00
getversion.c tests: cmd: don't recurse 2022-04-01 17:58:23 -07:00
libzfs_input_check.c Miscellaneous ZTS fixes 2022-09-29 08:56:42 -07:00
Makefile.am Add Linux posix_fadvise support 2022-09-08 10:29:41 -07:00
mkbusy.c Enable -Wwrite-strings 2022-06-29 14:08:54 -07:00
mkfile.c Fix userspace memory leaks found by Clang Static Analzyer 2022-09-26 17:18:05 -07:00
mkfiles.c Enable -Wwrite-strings 2022-06-29 14:08:54 -07:00
mktree.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
mmap_exec.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
mmap_libaio.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
mmap_seek.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
mmap_sync.c Fix unsafe string operations 2022-09-27 16:47:24 -07:00
mmapwrite.c Miscellaneous ZTS fixes 2022-09-29 08:56:42 -07:00
nvlist_to_lua.c Handle possible null pointers from malloc/strdup/strndup() 2022-10-06 17:18:40 -07:00
readmmap.c Miscellaneous ZTS fixes 2022-09-29 08:56:42 -07:00
rename_dir.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
rm_lnkcnt_zero_file.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
send_doall.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
stride_dd.c Enable -Wwrite-strings 2022-06-29 14:08:54 -07:00
suid_write_to_file.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
threadsappend.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
truncate_test.c tests: move C test helpers into test cmd 2022-04-01 18:01:39 -07:00
user_ns_exec.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
xattrtest.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
zed_fd_spill-zedlet.c Miscellaneous ZTS fixes 2022-09-29 08:56:42 -07:00
zfs_diff-socket.c Cleanup: Switch to strlcpy from strncpy 2022-09-27 16:35:29 -07:00