ubifs: fix wrong use of crypto_shash_descsize()
[linux-2.6-microblaze.git] / fs / ubifs / replay.c
index b28ac4d..01fcf79 100644 (file)
@@ -601,18 +601,12 @@ static int authenticate_sleb(struct ubifs_info *c, struct ubifs_scan_leb *sleb,
        struct ubifs_scan_node *snod;
        int n_nodes = 0;
        int err;
-       u8 *hash, *hmac;
+       u8 hash[UBIFS_HASH_ARR_SZ];
+       u8 hmac[UBIFS_HMAC_ARR_SZ];
 
        if (!ubifs_authenticated(c))
                return sleb->nodes_cnt;
 
-       hash = kmalloc(crypto_shash_descsize(c->hash_tfm), GFP_NOFS);
-       hmac = kmalloc(c->hmac_desc_len, GFP_NOFS);
-       if (!hash || !hmac) {
-               err = -ENOMEM;
-               goto out;
-       }
-
        list_for_each_entry(snod, &sleb->nodes, list) {
 
                n_nodes++;
@@ -662,9 +656,6 @@ static int authenticate_sleb(struct ubifs_info *c, struct ubifs_scan_leb *sleb,
                err = 0;
        }
 out:
-       kfree(hash);
-       kfree(hmac);
-
        return err ? err : n_nodes - n_not_auth;
 }