diff options
| author | riastradh <riastradh@NetBSD.org> | 2021-09-09 23:26:36 +0000 |
|---|---|---|
| committer | riastradh <riastradh@NetBSD.org> | 2021-09-09 23:26:36 +0000 |
| commit | fd843b8cabda76b276986e157a954d1c614796e6 (patch) | |
| tree | 4de51787f88b51f5f1be1e91703607dfa08c05e4 /sys/dev/raidframe | |
| parent | e85d790adde2e26c6a18413a57b3c149b56f6977 (diff) | |
sys/dev: Memset zero before copyout.
Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
I think the iwi(4), mcd(4), and ses(4) changes actually plug leaks;
the raidframe(4) change probably doesn't (but doesn't hurt).
Diffstat (limited to 'sys/dev/raidframe')
| -rw-r--r-- | sys/dev/raidframe/rf_netbsdkintf.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/dev/raidframe/rf_netbsdkintf.c b/sys/dev/raidframe/rf_netbsdkintf.c index 3be5cbbab19..d1bda3553e0 100644 --- a/sys/dev/raidframe/rf_netbsdkintf.c +++ b/sys/dev/raidframe/rf_netbsdkintf.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.400 2021/08/28 16:00:52 oster Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.401 2021/09/09 23:26:37 riastradh Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***********************************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.400 2021/08/28 16:00:52 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.401 2021/09/09 23:26:37 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_autoconfig.h" @@ -3859,6 +3859,8 @@ void rf_check_recon_status_ext(RF_Raid_t *raidPtr, RF_ProgressInfo_t *info) { + memset(info, 0, sizeof(*info)); + if (raidPtr->status != rf_rs_reconstructing) { info->total = 100; info->completed = 100; @@ -3874,6 +3876,8 @@ void rf_check_parityrewrite_status_ext(RF_Raid_t *raidPtr, RF_ProgressInfo_t *info) { + memset(info, 0, sizeof(*info)); + if (raidPtr->parity_rewrite_in_progress == 1) { info->total = raidPtr->Layout.numStripe; info->completed = raidPtr->parity_rewrite_stripes_done; @@ -3889,6 +3893,8 @@ void rf_check_copyback_status_ext(RF_Raid_t *raidPtr, RF_ProgressInfo_t *info) { + memset(info, 0, sizeof(*info)); + if (raidPtr->copyback_in_progress == 1) { info->total = raidPtr->Layout.numStripe; info->completed = raidPtr->copyback_stripes_done; |
