git: aca2a7facabb - main - stack_zero is not needed before stack_save

From: Eric van Gyzen <vangyzen_at_FreeBSD.org>
Date: Sat, 26 Mar 2022 01:11:46 UTC
The branch main has been updated by vangyzen:

URL: https://cgit.FreeBSD.org/src/commit/?id=aca2a7facabb3522e19f998c27f96a55b65cf959

commit aca2a7facabb3522e19f998c27f96a55b65cf959
Author:     Eric van Gyzen <vangyzen@FreeBSD.org>
AuthorDate: 2022-03-07 16:01:45 +0000
Commit:     Eric van Gyzen <vangyzen@FreeBSD.org>
CommitDate: 2022-03-26 01:10:38 +0000

    stack_zero is not needed before stack_save
    
    The man page was recently clarified to commit to this contract.
    
    MFC after:      1 week
    Sponsored by:   Dell EMC Isilon
---
 sys/compat/linuxkpi/common/src/linux_compat.c | 1 -
 sys/dev/ocs_fc/ocs_os.c                       | 1 -
 sys/dev/xen/debug/debug.c                     | 1 -
 sys/kern/subr_epoch.c                         | 1 -
 sys/kern/subr_kdb.c                           | 1 -
 sys/kern/subr_witness.c                       | 2 --
 6 files changed, 7 deletions(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
index 70e208da428f..4159cef9ffba 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -2618,7 +2618,6 @@ linux_dump_stack(void)
 #ifdef STACK
 	struct stack st;
 
-	stack_zero(&st);
 	stack_save(&st);
 	stack_print(&st);
 #endif
diff --git a/sys/dev/ocs_fc/ocs_os.c b/sys/dev/ocs_fc/ocs_os.c
index 4e4edea2e63f..bd55b6c0bdce 100644
--- a/sys/dev/ocs_fc/ocs_os.c
+++ b/sys/dev/ocs_fc/ocs_os.c
@@ -857,7 +857,6 @@ void ocs_print_stack(void)
 #if defined(STACK)
 	struct stack st;
 
-	stack_zero(&st);
 	stack_save(&st);
 	stack_print(&st);
 #endif
diff --git a/sys/dev/xen/debug/debug.c b/sys/dev/xen/debug/debug.c
index c4562c02ed03..bd1d6101f392 100644
--- a/sys/dev/xen/debug/debug.c
+++ b/sys/dev/xen/debug/debug.c
@@ -74,7 +74,6 @@ xendebug_filter(void *arg __unused)
 #if defined(STACK) && defined(DDB)
 	struct stack st;
 
-	stack_zero(&st);
 	stack_save(&st);
 
 	mtx_lock_spin(&lock);
diff --git a/sys/kern/subr_epoch.c b/sys/kern/subr_epoch.c
index 74524fb3f97e..100221cd62f9 100644
--- a/sys/kern/subr_epoch.c
+++ b/sys/kern/subr_epoch.c
@@ -195,7 +195,6 @@ epoch_trace_report(const char *fmt, ...)
 	va_list ap;
 	struct stackentry se, *new;
 
-	stack_zero(&se.se_stack);	/* XXX: is it really needed? */
 	stack_save(&se.se_stack);
 
 	/* Tree is never reduced - go lockless. */
diff --git a/sys/kern/subr_kdb.c b/sys/kern/subr_kdb.c
index 14a0205fc098..b189fe303e0f 100644
--- a/sys/kern/subr_kdb.c
+++ b/sys/kern/subr_kdb.c
@@ -438,7 +438,6 @@ kdb_backtrace(void)
 		struct stack st;
 
 		printf("KDB: stack backtrace:\n");
-		stack_zero(&st);
 		stack_save(&st);
 		stack_print_ddb(&st);
 	}
diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c
index db82450f0570..57f63d362a4f 100644
--- a/sys/kern/subr_witness.c
+++ b/sys/kern/subr_witness.c
@@ -3081,7 +3081,6 @@ witness_lock_order_add(struct witness *parent, struct witness *child)
 	data->wlod_key = key;
 	w_lohash.wloh_array[hash] = data;
 	w_lohash.wloh_count++;
-	stack_zero(&data->wlod_stack);
 	stack_save(&data->wlod_stack);
 	return (1);
 }
@@ -3118,7 +3117,6 @@ witness_debugger(int cond, const char *msg)
 		sbuf_new(&sb, buf, sizeof(buf), SBUF_FIXEDLEN);
 		sbuf_set_drain(&sb, witness_output_drain, NULL);
 
-		stack_zero(&st);
 		stack_save(&st);
 		witness_output("stack backtrace:\n");
 		stack_sbuf_print_ddb(&sb, &st);