]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
dm verity fec: fix block calculation
authorSami Tolvanen <samitolvanen@google.com>
Tue, 21 Jun 2016 18:02:42 +0000 (11:02 -0700)
committerMike Snitzer <snitzer@redhat.com>
Sat, 2 Jul 2016 03:29:08 +0000 (23:29 -0400)
do_div was replaced with div64_u64 at some point, causing a bug with
block calculation due to incompatible semantics of the two functions.

Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Fixes: a739ff3f543a ("dm verity: add support for forward error correction")
Cc: stable@vger.kernel.org # v4.5+
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-verity-fec.c

index 459a9f8905edb22b81205e5196910b66956eaa1f..0f0eb8a3d922a212583ba491f3899a69a2b91bd6 100644 (file)
@@ -453,9 +453,7 @@ int verity_fec_decode(struct dm_verity *v, struct dm_verity_io *io,
         */
 
        offset = block << v->data_dev_block_bits;
-
-       res = offset;
-       div64_u64(res, v->fec->rounds << v->data_dev_block_bits);
+       res = div64_u64(offset, v->fec->rounds << v->data_dev_block_bits);
 
        /*
         * The base RS block we can feed to the interleaver to find out all