block/keyslot-manager: use kvfree_sensitive()
authorEric Biggers <ebiggers@google.com>
Tue, 16 Jun 2020 15:56:54 +0000 (08:56 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 29 Jun 2020 19:24:05 +0000 (13:24 -0600)
Make blk_ksm_destroy() use the kvfree_sensitive() function (which was
introduced in v5.8-rc1) instead of open-coding it.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/keyslot-manager.c

index c2ef41b..35abcb1 100644 (file)
@@ -374,8 +374,7 @@ void blk_ksm_destroy(struct blk_keyslot_manager *ksm)
        if (!ksm)
                return;
        kvfree(ksm->slot_hashtable);
-       memzero_explicit(ksm->slots, sizeof(ksm->slots[0]) * ksm->num_slots);
-       kvfree(ksm->slots);
+       kvfree_sensitive(ksm->slots, sizeof(ksm->slots[0]) * ksm->num_slots);
        memzero_explicit(ksm, sizeof(*ksm));
 }
 EXPORT_SYMBOL_GPL(blk_ksm_destroy);