]> git.karo-electronics.de Git - karo-tx-linux.git/commit
[PATCH] md: Avoid overflow in raid0 calculation with large components.
authorNeilBrown <neilb@suse.de>
Mon, 21 May 2007 01:33:03 +0000 (11:33 +1000)
committerWilly Tarreau <w@1wt.eu>
Wed, 15 Aug 2007 08:02:20 +0000 (10:02 +0200)
commitcb9072a6c6322f4615576537b024a42252b7ac15
tree2ae02a16146c99268b7b8ad7c2ef90039ea257ea
parent5c648b32393875e46f767405eb41911a149eb008
[PATCH] md: Avoid overflow in raid0 calculation with large components.

If a raid0 has a component device larger than 4TB, and is accessed on
a 32bit machines, then as 'chunk' is unsigned lock,
   chunk << chunksize_bits
can overflow (this can be as high as the size of the device in KB).
chunk itself will not overflow (without triggering a BUG).

So change 'chunk' to be 'sector_t, and get rid of the 'BUG' as it becomes
impossible to hit.

Cc: "Jeff Zheng" <Jeff.Zheng@endace.com>
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/md/raid0.c