aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2015-01-16 22:07:07 +0000
committerMark Brown <broonie@kernel.org>2015-01-16 22:07:07 +0000
commit326dc1f1f301eaaf91619c359b85cd98c2ff4374 (patch)
tree627fe244b8cd12302cd94328223bbd8d74553c52 /block
parent8b16dde2a85c26b48518758c99a7b4ce4820b019 (diff)
parenta47897538c3e1f71c35691a1f73e73dd9149977c (diff)
downloadlinux-linaro-stable-326dc1f1f301eaaf91619c359b85cd98c2ff4374.tar.gz
Merge branch 'linux-linaro-lsk-v3.14' into linux-linaro-lsk-v3.14-android
Diffstat (limited to 'block')
-rw-r--r--block/blk-mq-cpumap.c2
-rw-r--r--block/genhd.c11
2 files changed, 10 insertions, 3 deletions
diff --git a/block/blk-mq-cpumap.c b/block/blk-mq-cpumap.c
index f8721278601c..78d38352bf8d 100644
--- a/block/blk-mq-cpumap.c
+++ b/block/blk-mq-cpumap.c
@@ -95,7 +95,7 @@ unsigned int *blk_mq_make_queue_map(struct blk_mq_reg *reg)
unsigned int *map;
/* If cpus are offline, map them to first hctx */
- map = kzalloc_node(sizeof(*map) * num_possible_cpus(), GFP_KERNEL,
+ map = kzalloc_node(sizeof(*map) * nr_cpu_ids, GFP_KERNEL,
reg->numa_node);
if (!map)
return NULL;
diff --git a/block/genhd.c b/block/genhd.c
index fed4f03e19c4..2651850347ea 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1070,9 +1070,16 @@ int disk_expand_part_tbl(struct gendisk *disk, int partno)
struct disk_part_tbl *old_ptbl = disk->part_tbl;
struct disk_part_tbl *new_ptbl;
int len = old_ptbl ? old_ptbl->len : 0;
- int target = partno + 1;
+ int i, target;
size_t size;
- int i;
+
+ /*
+ * check for int overflow, since we can get here from blkpg_ioctl()
+ * with a user passed 'partno'.
+ */
+ target = partno + 1;
+ if (target < 0)
+ return -EINVAL;
/* disk_max_parts() is zero during initialization, ignore if so */
if (disk_max_parts(disk) && target > disk_max_parts(disk))