Module Name:    src
Committed By:   tkusumi
Date:           Sat Nov 30 05:35:57 UTC 2019

Modified Files:
        src/sys/dev/dm: dm_ioctl.c

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/dm/dm_ioctl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/dm/dm_ioctl.c
diff -u src/sys/dev/dm/dm_ioctl.c:1.33 src/sys/dev/dm/dm_ioctl.c:1.34
--- src/sys/dev/dm/dm_ioctl.c:1.33	Sun Nov 11 10:21:11 2018
+++ src/sys/dev/dm/dm_ioctl.c	Sat Nov 30 05:35:57 2019
@@ -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 
 		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);

Reply via email to