Skip to content

Commit dbc03e8

Browse files
Zhen Leijgross1
authored andcommitted
xen/unpopulated-alloc: fix error return code in fill_list()
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>
1 parent 970655a commit dbc03e8

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/xen/unpopulated-alloc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ static int fill_list(unsigned int nr_pages)
3939
}
4040

4141
pgmap = kzalloc(sizeof(*pgmap), GFP_KERNEL);
42-
if (!pgmap)
42+
if (!pgmap) {
43+
ret = -ENOMEM;
4344
goto err_pgmap;
45+
}
4446

4547
pgmap->type = MEMORY_DEVICE_GENERIC;
4648
pgmap->range = (struct range) {

0 commit comments

Comments
 (0)