diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2012-01-20 07:55:30 -0500 |
---|---|---|
committer | Matthew Wilcox <matthew.r.wilcox@intel.com> | 2012-07-31 13:15:43 -0400 |
commit | 22fff826e715e9727d3c7a69f15e602a9801b673 (patch) | |
tree | b7c317cb56682e691c8c22423b81a15530e77421 /drivers/block/nvme.c | |
parent | c7d36ab8fa04c213328119a9c0d66985fe204ee5 (diff) |
NVMe: handle allocation failure in nvme_map_user_pages()
We should return here and avoid a NULL dereference.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Diffstat (limited to 'drivers/block/nvme.c')
-rw-r--r-- | drivers/block/nvme.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/block/nvme.c b/drivers/block/nvme.c index 6c0eb768562f..064e86a6bb4e 100644 --- a/drivers/block/nvme.c +++ b/drivers/block/nvme.c @@ -1044,6 +1044,8 @@ static struct nvme_iod *nvme_map_user_pages(struct nvme_dev *dev, int write, offset = offset_in_page(addr); count = DIV_ROUND_UP(offset + length, PAGE_SIZE); pages = kcalloc(count, sizeof(*pages), GFP_KERNEL); + if (!pages) + return ERR_PTR(-ENOMEM); err = get_user_pages_fast(addr, count, 1, pages); if (err < count) { |