zfs/lib
Richard Yao 67395be0c2
Fix userland dereference NULL return value bugs
* `zstream_do_token()` does not handle failures from `libzfs_init()`

 * `ztest_global_vars_to_zdb_args()` does not handle failures from
   `calloc()`.

 * `zfs_snapshot_nvl()` will pass an offset to a NULL pointer as a
   source to `strlcpy()` if the provided nvlist is `NULL`.

We handle these by doing what the existing error handling does for other
errors involving these functions.

Coverity complained about these. It had complained about several more,
but one was fixed by 570ca4441e and
another was a false positive. The remaining complaints labelled
"dereferece null return vaue" involve fetching things stored in
in-kernel data structures via `list_head()/list_next()`,
`AVL_PREV()/AVL_NEXT()` and `zfs_btree_find()`. Most of them occur in
void functions that have no error handling. They are much harder to
analyze than the two fixed in this patch, so they are left for a
follow-up patch.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #13971
2022-09-30 17:02:57 -07:00
..
libavl cppcheck: explicitly exclude kernel code from userspace checks 2022-05-10 10:20:55 -07:00
libefi Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
libicp Introduce BLAKE3 checksums as an OpenZFS feature 2022-06-08 15:55:57 -07:00
libnvpair Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
libshare Fix unsafe string operations 2022-09-27 16:47:24 -07:00
libspl Reduce false positives from Static Analyzers 2022-09-30 15:30:12 -07:00
libtpool Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
libunicode cppcheck: explicitly exclude kernel code from userspace checks 2022-05-10 10:20:55 -07:00
libuutil Cleanup: Remove unused uu_pname code 2022-09-19 17:33:52 -07:00
libzfs Fix userland dereference NULL return value bugs 2022-09-30 17:02:57 -07:00
libzfs_core Implement a new type of zfs receive: corrective receive (-c) 2022-07-28 15:52:46 -07:00
libzfsbootenv Fix unchecked return values and unused return values 2022-09-23 16:52:03 -07:00
libzpool Fix double const qualifier declarations 2022-09-30 15:34:39 -07:00
libzstd cppcheck: explicitly exclude kernel code from userspace checks 2022-05-10 10:20:55 -07:00
libzutil Fix double const qualifier declarations 2022-09-30 15:34:39 -07:00
Makefile.am autoconf: use include directives instead of recursing down lib 2022-05-10 10:18:11 -07:00