diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2012-01-20 13:55:30 +0100 |
---|---|---|
committer | Matthew Wilcox <matthew.r.wilcox@intel.com> | 2012-07-31 19:15:43 +0200 |
commit | 22fff826e715e9727d3c7a69f15e602a9801b673 (patch) | |
tree | b7c317cb56682e691c8c22423b81a15530e77421 /drivers | |
parent | NVMe: Fix uninitialized iod compiler warning (diff) | |
download | linux-22fff826e715e9727d3c7a69f15e602a9801b673.tar.xz linux-22fff826e715e9727d3c7a69f15e602a9801b673.zip |
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')
-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) { |