dm bufio: subtract the number of initial sectors in dm_bufio_get_device_size
authorMikulas Patocka <mpatocka@redhat.com>
Tue, 23 Feb 2021 20:21:20 +0000 (21:21 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 9 Mar 2021 10:11:12 +0000 (11:11 +0100)
commit7bda53f46387bc2b40a80befb1a5648dd9840e9c
treee646115f923bb5c8de980a0cabd02e1e742dbd17
parenta2501d87663b84c288188d63da4632018b627829
dm bufio: subtract the number of initial sectors in dm_bufio_get_device_size

commit a14e5ec66a7a66e57b24e2469f9212a78460207e upstream.

dm_bufio_get_device_size returns the device size in blocks. Before
returning the value, we must subtract the nubmer of starting
sectors. The number of starting sectors may not be divisible by block
size.

Note that currently, no target is using dm_bufio_set_sector_offset and
dm_bufio_get_device_size simultaneously, so this change has no effect.
However, an upcoming dm-verity-fec fix needs this change.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Reviewed-by: Milan Broz <gmazyland@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-bufio.c