Commit 0bc62284 authored by Yan, Zheng's avatar Yan, Zheng Committed by Sage Weil

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: default avatarYan, Zheng <zyan@redhat.com>
parent 792c3a91
...@@ -41,7 +41,7 @@ static long __validate_layout(struct ceph_mds_client *mdsc, ...@@ -41,7 +41,7 @@ static long __validate_layout(struct ceph_mds_client *mdsc,
/* validate striping parameters */ /* validate striping parameters */
if ((l->object_size & ~PAGE_MASK) || if ((l->object_size & ~PAGE_MASK) ||
(l->stripe_unit & ~PAGE_MASK) || (l->stripe_unit & ~PAGE_MASK) ||
(l->stripe_unit != 0 && ((unsigned)l->stripe_unit != 0 &&
((unsigned)l->object_size % (unsigned)l->stripe_unit))) ((unsigned)l->object_size % (unsigned)l->stripe_unit)))
return -EINVAL; return -EINVAL;
......
Markdown is supported
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