Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/dm dm: Always initialize target's status string



details:   https://anonhg.NetBSD.org/src/rev/7a7076494e90
branches:  trunk
changeset: 1005144:7a7076494e90
user:      tkusumi <tkusumi%NetBSD.org@localhost>
date:      Sat Nov 30 05:35:57 2019 +0000

description:
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:

 sys/dev/dm/dm_ioctl.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (31 lines):

diff -r 1dd36aa009d9 -r 7a7076494e90 sys/dev/dm/dm_ioctl.c
--- a/sys/dev/dm/dm_ioctl.c     Sat Nov 30 05:28:28 2019 +0000
+++ b/sys/dev/dm/dm_ioctl.c     Sat Nov 30 05:35:57 2019 +0000
@@ -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 @@
                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);



Home | Main Index | Thread Index | Old Index