{
        struct dcp_blob_fmt *b = (struct dcp_blob_fmt *)p->blob;
        int blen, ret;
-       u8 plain_blob_key[AES_KEYSIZE_128];
+       u8 *plain_blob_key;
 
        blen = calc_blob_len(p->key_len);
        if (blen > MAX_BLOB_SIZE)
                return -E2BIG;
 
+       plain_blob_key = kmalloc(AES_KEYSIZE_128, GFP_KERNEL);
+       if (!plain_blob_key)
+               return -ENOMEM;
+
        b->fmt_version = DCP_BLOB_VERSION;
        get_random_bytes(b->nonce, AES_KEYSIZE_128);
        get_random_bytes(plain_blob_key, AES_KEYSIZE_128);
        ret = 0;
 
 out:
-       memzero_explicit(plain_blob_key, sizeof(plain_blob_key));
+       memzero_explicit(plain_blob_key, AES_KEYSIZE_128);
+       kfree(plain_blob_key);
 
        return ret;
 }
 {
        struct dcp_blob_fmt *b = (struct dcp_blob_fmt *)p->blob;
        int blen, ret;
-       u8 plain_blob_key[AES_KEYSIZE_128];
+       u8 *plain_blob_key = NULL;
 
        if (b->fmt_version != DCP_BLOB_VERSION) {
                pr_err("DCP blob has bad version: %i, expected %i\n",
                goto out;
        }
 
+       plain_blob_key = kmalloc(AES_KEYSIZE_128, GFP_KERNEL);
+       if (!plain_blob_key) {
+               ret = -ENOMEM;
+               goto out;
+       }
+
        ret = decrypt_blob_key(b->blob_key, plain_blob_key);
        if (ret) {
                pr_err("Unable to decrypt blob key: %i\n", ret);
 
        ret = 0;
 out:
-       memzero_explicit(plain_blob_key, sizeof(plain_blob_key));
+       if (plain_blob_key) {
+               memzero_explicit(plain_blob_key, AES_KEYSIZE_128);
+               kfree(plain_blob_key);
+       }
 
        return ret;
 }