From: Yan, Zheng Date: Tue, 14 Oct 2014 07:38:01 +0000 (+0800) Subject: ceph: fix divide-by-zero in __validate_layout() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0bc62284ee3f2a228c64902ed818b6ba8e04159b;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 --- diff --git a/fs/ceph/ioctl.c b/fs/ceph/ioctl.c index d7dc812a2249..f851d8d70158 100644 --- a/fs/ceph/ioctl.c +++ b/fs/ceph/ioctl.c @@ -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;