Skip to content

Commit

Permalink
PAM: Fix uninitialized value read
Browse files Browse the repository at this point in the history
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 <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes openzfs#13957
  • Loading branch information
ryao authored and datacore-rm committed Dec 26, 2022
1 parent 16f57fc commit 5951771
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion contrib/pam_zfs_key/pam_zfs_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,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);
Expand Down

0 comments on commit 5951771

Please sign in to comment.