summaryrefslogtreecommitdiff
path: root/block/blk-cgroup.c
diff options
context:
space:
mode:
authorVivek Goyal <vgoyal@redhat.com>2010-10-01 23:16:41 +0400
committerJens Axboe <jaxboe@fusionio.com>2010-10-01 23:16:41 +0400
commit9355aede5a3c4975e0ba8bbfe2b9d1fd73308916 (patch)
tree73db212009de0e60d71d343b737d6a90449b06b8 /block/blk-cgroup.c
parent5e901a2b95db709c5e40599ff4df6029be1e2a12 (diff)
downloadlinux-9355aede5a3c4975e0ba8bbfe2b9d1fd73308916.tar.xz
blkio-throttle: limit max iops value to UINT_MAX
- Limit max iops value to UINT_MAX and return error to user if value is more than that instead of accepting bigger values and truncating implicitly. Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'block/blk-cgroup.c')
-rw-r--r--block/blk-cgroup.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 52c12130a5de..0f59b23096db 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -656,10 +656,10 @@ static int blkio_policy_parse_and_set(char *buf,
{
char *s[4], *p, *major_s = NULL, *minor_s = NULL;
int ret;
- unsigned long major, minor, temp, iops;
+ unsigned long major, minor, temp;
int i = 0;
dev_t dev;
- u64 bps;
+ u64 bps, iops;
memset(s, 0, sizeof(s));
@@ -731,13 +731,16 @@ static int blkio_policy_parse_and_set(char *buf,
break;
case BLKIO_THROTL_read_iops_device:
case BLKIO_THROTL_write_iops_device:
- ret = strict_strtoul(s[1], 10, &iops);
+ ret = strict_strtoull(s[1], 10, &iops);
if (ret)
return -EINVAL;
+ if (iops > THROTL_IOPS_MAX)
+ return -EINVAL;
+
newpn->plid = plid;
newpn->fileid = fileid;
- newpn->val.iops = iops;
+ newpn->val.iops = (unsigned int)iops;
break;
}
break;