]> git.baikalelectronics.ru Git - kernel.git/commit
dm switch: simplify conditional in alloc_region_table()
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Wed, 28 Oct 2015 18:54:21 +0000 (03:54 +0900)
committerMike Snitzer <snitzer@redhat.com>
Sat, 31 Oct 2015 23:06:06 +0000 (19:06 -0400)
commit0b0f948a4e5ce3ab84aced378d1970b9ac108c16
treea94ce06ad5d8fe99c92a09c80ed60c7d8c8882a6
parent202c3ab61a75a8d58fae0b4be48d66f9d2c1bb9a
dm switch: simplify conditional in alloc_region_table()

The variable sctx->nr_regions has type unsigned long and the variable
nr_regions has type sector_t.

Thus the variables may be different when overflow happens.
Changed the conditional to "if (nr_regions >= ULONG_MAX)".
Also move the assignment of nr_regions after sector_div()
and the sanity check which looks more sane.

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Reviewed-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-switch.c