Skip to content
Commit aad9ae45 authored by Tomohiro Kusumi's avatar Tomohiro Kusumi Committed by Mike Snitzer
Browse files

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: default avatarTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Reviewed-by: default avatarMikulas Patocka <mpatocka@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent f49e869a
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment