HomeFreeBSD

Linux: Silence static analyzer warning in crypto_create_ctx_template()

Description

Linux: Silence static analyzer warning in crypto_create_ctx_template()

A CodeChecker report from Clang's CTU analysis indicated that we were
assigning uninitialized values in crypto_create_ctx_template() when we
call it from zio_crypt_key_init(). This occurs because the ->cm_param
and ->cm_param_len fields are uninitialized. Thankfully, the
uninitialized values are only used in the skein via
KCF_PROV_CREATE_CTX_TEMPLATE() -> skein_create_ctx_template() ->
skein_mac_ctx_build() -> skein_get_digest_bitlen(), but that should not
be called from here. We fix this to avoid a possible trap should this
code change in the future.

The FreeBSD version of zio_crypt_key_init() is unaffected.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14575

Details

Provenance
Richard Yao <richard.yao@alumni.stonybrook.edu>Authored on Mar 5 2023, 4:48 AM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Mar 8 2023, 9:51 PM
Parents
rG51f55742f6b8: Suppress Clang Static Analyzer warning in bpobj_enqueue()
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rGc2550a136ed5: Linux: Silence static analyzer warning in crypto_create_ctx_template() (authored by Richard Yao <richard.yao@alumni.stonybrook.edu>).Mar 8 2023, 9:51 PM