From 9a49c6b782443ba6e627f2261c45f082ad843094 Mon Sep 17 00:00:00 2001 From: Richard Yao Date: Tue, 27 Sep 2022 19:48:35 -0400 Subject: [PATCH] PAM: Fix uninitialized value read Clang's static analyzer found that config.uid is uninitialized when zfs_key_config_load() returns an error. Oddly, this was not included in the unchecked return values that Coverity found. Reviewed-by: Brian Behlendorf Signed-off-by: Richard Yao Closes #13957 --- contrib/pam_zfs_key/pam_zfs_key.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/pam_zfs_key/pam_zfs_key.c b/contrib/pam_zfs_key/pam_zfs_key.c index e0bbd249af..8c59fc7eb7 100644 --- a/contrib/pam_zfs_key/pam_zfs_key.c +++ b/contrib/pam_zfs_key/pam_zfs_key.c @@ -810,7 +810,9 @@ pam_sm_close_session(pam_handle_t *pamh, int flags, return (PAM_SUCCESS); } zfs_key_config_t config; - zfs_key_config_load(pamh, &config, argc, argv); + if (zfs_key_config_load(pamh, &config, argc, argv) != 0) { + return (PAM_SESSION_ERR); + } if (config.uid < 1000) { zfs_key_config_free(&config); return (PAM_SUCCESS);