aboutsummaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorDimitry Andric <[email protected]>2024-10-29 20:05:02 +0100
committerGitHub <[email protected]>2024-10-29 15:05:02 -0400
commit2bf15202110767b6adbacc02d7e9dae1c305d944 (patch)
tree6ae03aabd5b1ad7a0512fa8f2653311e52f2c79f /module
parentc480e06d88e07fe5b8aaa920cc966498bb321a8d (diff)
Fix gcc uninitialized warning in FreeBSD zio_crypt.c
In FreeBSD's `zio_do_crypt_data()`, ensure that two `struct uio` variables are cleared before copying data out of them. This avoids accessing garbage data, and fixes gcc `-Wuninitialized` warnings. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Toomas Soome <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Dimitry Andric <[email protected]> Closes #16688
Diffstat (limited to 'module')
-rw-r--r--module/os/freebsd/zfs/zio_crypt.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/module/os/freebsd/zfs/zio_crypt.c b/module/os/freebsd/zfs/zio_crypt.c
index 2b62abccc..feaca93fb 100644
--- a/module/os/freebsd/zfs/zio_crypt.c
+++ b/module/os/freebsd/zfs/zio_crypt.c
@@ -1686,11 +1686,10 @@ zio_do_crypt_data(boolean_t encrypt, zio_crypt_key_t *key,
freebsd_crypt_session_t *tmpl = NULL;
uint8_t *authbuf = NULL;
-
+ memset(&puio_s, 0, sizeof (puio_s));
+ memset(&cuio_s, 0, sizeof (cuio_s));
zfs_uio_init(&puio, &puio_s);
zfs_uio_init(&cuio, &cuio_s);
- memset(GET_UIO_STRUCT(&puio), 0, sizeof (struct uio));
- memset(GET_UIO_STRUCT(&cuio), 0, sizeof (struct uio));
#ifdef FCRYPTO_DEBUG
printf("%s(%s, %p, %p, %d, %p, %p, %u, %s, %p, %p, %p)\n",