X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Flov%2Flproc_lov.c;fp=lustre%2Flov%2Flproc_lov.c;h=a65b2508fbe65a375ce3d0b8cc385e6bd55173eb;hp=bce82d204eb94dc94f6bb42d12f2e0a860b0a45d;hb=d9e0c9f346d0f0cccfa37737807d6f9d08255ab7;hpb=c4c17fa4a3f5d9c3df44e19ab3385c8de655cdef diff --git a/lustre/lov/lproc_lov.c b/lustre/lov/lproc_lov.c index bce82d2..a65b250 100644 --- a/lustre/lov/lproc_lov.c +++ b/lustre/lov/lproc_lov.c @@ -56,16 +56,23 @@ static ssize_t lov_stripesize_seq_write(struct file *file, { struct obd_device *dev = ((struct seq_file *)file->private_data)->private; struct lov_desc *desc; - s64 val; + char kernbuf[22] = ""; + u64 val; int rc; LASSERT(dev != NULL); desc = &dev->u.lov.desc; - rc = lprocfs_str_with_units_to_s64(buffer, count, &val, '1'); - if (rc) + + if (count >= sizeof(kernbuf)) + return -EINVAL; + + if (copy_from_user(kernbuf, buffer, count)) + return -EFAULT; + kernbuf[count] = 0; + + rc = sysfs_memparse(kernbuf, count, &val, "B"); + if (rc < 0) return rc; - if (val < 0) - return -ERANGE; lov_fix_desc_stripe_size(&val); desc->ld_default_stripe_size = val;