Skip to content

Commit

Permalink
xen/unpopulated-alloc: fix error return code in fill_list()
Browse files Browse the repository at this point in the history
[ Upstream commit dbc03e8 ]

Fix to return a negative error code from the error handling case instead
of 0, as done elsewhere in this function.

Fixes: a4574f6 ("mm/memremap_pages: convert to 'struct range'")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Link: https://lore.kernel.org/r/20210508021913.1727-1-thunder.leizhen@huawei.com
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Zhen Lei authored and gregkh committed May 19, 2021
1 parent 0581225 commit 1d8d7e0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/xen/unpopulated-alloc.c
Expand Up @@ -39,8 +39,10 @@ static int fill_list(unsigned int nr_pages)
}

pgmap = kzalloc(sizeof(*pgmap), GFP_KERNEL);
if (!pgmap)
if (!pgmap) {
ret = -ENOMEM;
goto err_pgmap;
}

pgmap->type = MEMORY_DEVICE_GENERIC;
pgmap->range = (struct range) {
Expand Down

0 comments on commit 1d8d7e0

Please sign in to comment.