]> git.baikalelectronics.ru Git - kernel.git/commit
md: linear: Fix a division by zero bug for very small arrays.
authorAndre Noll <maan@systemlinux.org>
Thu, 6 Nov 2008 08:41:24 +0000 (19:41 +1100)
committerNeilBrown <neilb@suse.de>
Thu, 6 Nov 2008 08:41:24 +0000 (19:41 +1100)
commit832524f33f0630f5508c6365aa23265bcfd2efe6
tree131e1fedd27d63d30896233d695594508bdbd04f
parent7a2a5668952c4b3c544acb80a9a1fde41354d2e0
md: linear: Fix a division by zero bug for very small arrays.

We currently oops with a divide error on starting a linear software
raid array consisting of at least two very small (< 500K) devices.

The bug is caused by the calculation of the hash table size which
tries to compute sector_div(sz, base) with "base" being zero due to
the small size of the component devices of the array.

Fix this by requiring the hash spacing to be at least one which
implies that also "base" is non-zero.

This bug has existed since about 2.6.14.

Cc: stable@kernel.org
Signed-off-by: Andre Noll <maan@systemlinux.org>
Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/linear.c