ceph: fix divide-by-zero in __validate_layout()

The 'stripe_unit' field is 64 bits, casting it to 32 bits can result zero.

Signed-off-by: Yan, Zheng <zyan@redhat.com>
This commit is contained in:
Yan, Zheng 2014-10-14 15:38:01 +08:00 committed by Sage Weil
parent 792c3a9149
commit 0bc62284ee
1 changed files with 1 additions and 1 deletions

View File

@ -41,7 +41,7 @@ static long __validate_layout(struct ceph_mds_client *mdsc,
/* validate striping parameters */
if ((l->object_size & ~PAGE_MASK) ||
(l->stripe_unit & ~PAGE_MASK) ||
(l->stripe_unit != 0 &&
((unsigned)l->stripe_unit != 0 &&
((unsigned)l->object_size % (unsigned)l->stripe_unit)))
return -EINVAL;