]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
linux: Explicitly initialize auto-cleanup variables
authorTomas Bzatek <tbzatek@redhat.com>
Fri, 9 Feb 2024 16:38:45 +0000 (17:38 +0100)
committerDaniel Wagner <wagi@monom.org>
Sun, 11 Feb 2024 14:18:12 +0000 (15:18 +0100)
gcc complains about potentially uninitialized variables.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
src/nvme/linux.c

index f072319318002c405a692a91da8d015218caa613..e29d9e7270d44cbcbfd57f75febc8c326ed07ffd 100644 (file)
@@ -725,7 +725,7 @@ int nvme_gen_dhchap_key(char *hostnqn, enum nvme_hmac_alg hmac,
                        unsigned char *key)
 {
        const char hmac_seed[] = "NVMe-over-Fabrics";
-       _cleanup_hmac_ctx_ HMAC_CTX *hmac_ctx;
+       _cleanup_hmac_ctx_ HMAC_CTX *hmac_ctx = NULL;
        const EVP_MD *md;
 
        ENGINE_load_builtin_engines();
@@ -881,7 +881,7 @@ int nvme_gen_dhchap_key(char *hostnqn, enum nvme_hmac_alg hmac,
 {
        const char hmac_seed[] = "NVMe-over-Fabrics";
        OSSL_PARAM params[2], *p = params;
-       _cleanup_ossl_lib_ctx_ OSSL_LIB_CTX *lib_ctx;
+       _cleanup_ossl_lib_ctx_ OSSL_LIB_CTX *lib_ctx = NULL;
        _cleanup_evp_mac_ctx_ EVP_MAC_CTX *mac_ctx = NULL;
        _cleanup_evp_mac_ EVP_MAC *mac = NULL;
        char *progq = NULL;