Commit 11901477 authored by Roger Pau Monne's avatar Roger Pau Monne Committed by Greg Kroah-Hartman

xen-blkfront: switch kcalloc to kvcalloc for large array allocation

commit 1d5c76e6 upstream.

There's no reason to request physically contiguous memory for those
allocations.

[boris: added CC to stable]

Cc: stable@vger.kernel.org
Reported-by: default avatarIan Jackson <ian.jackson@citrix.com>
Signed-off-by: default avatarRoger Pau Monné <roger.pau@citrix.com>
Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
Acked-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d8a303bd
......@@ -1310,11 +1310,11 @@ static void blkif_free_ring(struct blkfront_ring_info *rinfo)
}
free_shadow:
kfree(rinfo->shadow[i].grants_used);
kvfree(rinfo->shadow[i].grants_used);
rinfo->shadow[i].grants_used = NULL;
kfree(rinfo->shadow[i].indirect_grants);
kvfree(rinfo->shadow[i].indirect_grants);
rinfo->shadow[i].indirect_grants = NULL;
kfree(rinfo->shadow[i].sg);
kvfree(rinfo->shadow[i].sg);
rinfo->shadow[i].sg = NULL;
}
......@@ -1353,7 +1353,7 @@ static void blkif_free(struct blkfront_info *info, int suspend)
for (i = 0; i < info->nr_rings; i++)
blkif_free_ring(&info->rinfo[i]);
kfree(info->rinfo);
kvfree(info->rinfo);
info->rinfo = NULL;
info->nr_rings = 0;
}
......@@ -1914,7 +1914,7 @@ static int negotiate_mq(struct blkfront_info *info)
if (!info->nr_rings)
info->nr_rings = 1;
info->rinfo = kcalloc(info->nr_rings,
info->rinfo = kvcalloc(info->nr_rings,
sizeof(struct blkfront_ring_info),
GFP_KERNEL);
if (!info->rinfo) {
......@@ -2232,15 +2232,15 @@ static int blkfront_setup_indirect(struct blkfront_ring_info *rinfo)
for (i = 0; i < BLK_RING_SIZE(info); i++) {
rinfo->shadow[i].grants_used =
kcalloc(grants,
kvcalloc(grants,
sizeof(rinfo->shadow[i].grants_used[0]),
GFP_NOIO);
rinfo->shadow[i].sg = kcalloc(psegs,
rinfo->shadow[i].sg = kvcalloc(psegs,
sizeof(rinfo->shadow[i].sg[0]),
GFP_NOIO);
if (info->max_indirect_segments)
rinfo->shadow[i].indirect_grants =
kcalloc(INDIRECT_GREFS(grants),
kvcalloc(INDIRECT_GREFS(grants),
sizeof(rinfo->shadow[i].indirect_grants[0]),
GFP_NOIO);
if ((rinfo->shadow[i].grants_used == NULL) ||
......@@ -2256,11 +2256,11 @@ static int blkfront_setup_indirect(struct blkfront_ring_info *rinfo)
out_of_memory:
for (i = 0; i < BLK_RING_SIZE(info); i++) {
kfree(rinfo->shadow[i].grants_used);
kvfree(rinfo->shadow[i].grants_used);
rinfo->shadow[i].grants_used = NULL;
kfree(rinfo->shadow[i].sg);
kvfree(rinfo->shadow[i].sg);
rinfo->shadow[i].sg = NULL;
kfree(rinfo->shadow[i].indirect_grants);
kvfree(rinfo->shadow[i].indirect_grants);
rinfo->shadow[i].indirect_grants = NULL;
}
if (!list_empty(&rinfo->indirect_pages)) {
......
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