diff options
| author | tkusumi <tkusumi@NetBSD.org> | 2019-11-30 05:35:57 +0000 |
|---|---|---|
| committer | tkusumi <tkusumi@NetBSD.org> | 2019-11-30 05:35:57 +0000 |
| commit | c015cba3673c0b8d8402ebe767166c9f9bbc0293 (patch) | |
| tree | 807c93487a633db2eb314f7124a9e5e36a72d414 /sys/dev/dm/dm_ioctl.c | |
| parent | 189a94c0fd4400e219db5d6115d88b34e1854801 (diff) | |
dm: Always initialize target's status string
Explicitly clear status string to prevent dmsetup(8) from
printing binary junk to stdout. Similar change has been
applied to DragonFlyBSD since 2015.
https://github.com/DragonFlyBSD/DragonFlyBSD/commit/a6cf54187fd7c3e994c573215806ec03572c038e
taken-from: DragonFlyBSD
Diffstat (limited to 'sys/dev/dm/dm_ioctl.c')
| -rw-r--r-- | sys/dev/dm/dm_ioctl.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/dev/dm/dm_ioctl.c b/sys/dev/dm/dm_ioctl.c index 81d451850a1..747ef596623 100644 --- a/sys/dev/dm/dm_ioctl.c +++ b/sys/dev/dm/dm_ioctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: dm_ioctl.c,v 1.33 2018/11/11 10:21:11 mlelstv Exp $ */ +/* $NetBSD: dm_ioctl.c,v 1.34 2019/11/30 05:35:57 tkusumi Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.33 2018/11/11 10:21:11 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.34 2019/11/30 05:35:57 tkusumi Exp $"); /* * Locking is used to synchronise between ioctl calls and between dm_table's @@ -927,6 +927,12 @@ dm_table_status_ioctl(prop_dictionary_t dm_dict) prop_dictionary_set_int32(target_dict, DM_TABLE_STAT, dmv->table_head.cur_active_table); + /* + * Explicitly clear DM_TABLE_PARAMS to prevent dmsetup(8) from + * printing junk when DM_TABLE_PARAMS was never initialized. + */ + prop_dictionary_set_cstring(target_dict, DM_TABLE_PARAMS, ""); + if (flags & DM_STATUS_TABLE_FLAG) { params = table_en->target->status (table_en->target_config); |
