zfs/cmd
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
..
raidz_test Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
zdb Fix unsafe string operations 2022-09-27 16:47:24 -07:00
zed Reduce false positives from Static Analyzers 2022-09-30 15:30:12 -07:00
zfs Fix unsafe string operations 2022-09-27 16:47:24 -07:00
zinject Fix unsafe string operations 2022-09-27 16:47:24 -07:00
zpool Fix userland resource leaks 2022-09-23 16:55:26 -07:00
zpool_influxdb Fix unchecked return values 2022-09-29 09:02:57 -07:00
zstream Fix userland dereference NULL return value bugs 2022-09-30 17:02:57 -07:00
Makefile.am Add zilstat script to report zil kstats in a user friendly manner 2022-09-02 13:24:07 -07:00
arc_summary cmd: move single-file binaries up, extract udev programs to udev/ 2022-05-10 10:20:34 -07:00
arcstat.in arcstat: fix -p option 2022-08-12 14:21:52 -07:00
dbufstat.in Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
fsck.zfs.in cmd: move single-file binaries up, extract udev programs to udev/ 2022-05-10 10:20:34 -07:00
mount_zfs.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
zfs_ids_to_path.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
zgenhostid.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
zhack.c Fix userland resource leaks 2022-09-23 16:55:26 -07:00
zilstat.in Add zilstat script to report zil kstats in a user friendly manner 2022-09-02 13:24:07 -07:00
ztest.c Fix userland dereference NULL return value bugs 2022-09-30 17:02:57 -07:00
zvol_wait cmd: move single-file binaries up, extract udev programs to udev/ 2022-05-10 10:20:34 -07:00