summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2021-01-22 15:03:56 -0800
committerBrian Behlendorf <[email protected]>2021-01-26 16:11:46 -0800
commit7454d2bb8d860bb49353c8b60dc980de82296f73 (patch)
tree24fdc89274a498ce10644602a71b7ace8e4c7c53
parent62d4287f279a0d184f8f332475f27af58b7aa87e (diff)
cppcheck: zpool_main.c possible null pointer dereference
Explicitly check for NULL to satisfy cppcheck that "val" can never be NULL when passed to printf(). This looks like a false positive since is_blank_str() can never take the false conditional branch when passed a NULL. But there's no harm in adding the extra check. Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #11508
-rw-r--r--cmd/zpool/zpool_main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c
index 3ac372866..50adc0add 100644
--- a/cmd/zpool/zpool_main.c
+++ b/cmd/zpool/zpool_main.c
@@ -2010,7 +2010,7 @@ zpool_print_cmd(vdev_cmd_data_list_t *vcdl, const char *pool, char *path)
* Mark empty values with dashes to make output
* awk-able.
*/
- if (is_blank_str(val))
+ if (val == NULL || is_blank_str(val))
val = "-";
printf("%*s", vcdl->uniq_cols_width[j], val);