Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
[linux-2.6-microblaze.git] / drivers / md / dm-verity-fec.c
index 684af08..0ce04e5 100644 (file)
@@ -212,12 +212,15 @@ static int fec_read_bufs(struct dm_verity *v, struct dm_verity_io *io,
        struct dm_verity_fec_io *fio = fec_io(io);
        u64 block, ileaved;
        u8 *bbuf, *rs_block;
-       u8 want_digest[v->digest_size];
+       u8 want_digest[HASH_MAX_DIGESTSIZE];
        unsigned n, k;
 
        if (neras)
                *neras = 0;
 
+       if (WARN_ON(v->digest_size > sizeof(want_digest)))
+               return -EINVAL;
+
        /*
         * read each of the rsn data blocks that are part of the RS block, and
         * interleave contents to available bufs