diff mbox series

[1/1] xen/unpopulated-alloc: fix error return code in fill_list()

Message ID 20210508021913.1727-1-thunder.leizhen@huawei.com
State Accepted
Commit dbc03e81586fc33e4945263fd6e09e22eb4b980f
Headers show
Series [1/1] xen/unpopulated-alloc: fix error return code in fill_list() | expand

Commit Message

Leizhen (ThunderTown) May 8, 2021, 2:19 a.m. UTC
Fix to return a negative error code from the error handling case instead
of 0, as done elsewhere in this function.

Fixes: a4574f63edc6 ("mm/memremap_pages: convert to 'struct range'")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>

---
 drivers/xen/unpopulated-alloc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

-- 
2.25.1

Comments

Juergen Gross May 10, 2021, 7:26 a.m. UTC | #1
On 08.05.21 04:19, Zhen Lei wrote:
> Fix to return a negative error code from the error handling case instead

> of 0, as done elsewhere in this function.

> 

> Fixes: a4574f63edc6 ("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>



Juergen
Juergen Gross May 10, 2021, 9:26 a.m. UTC | #2
On 08.05.21 04:19, Zhen Lei wrote:
> Fix to return a negative error code from the error handling case instead

> of 0, as done elsewhere in this function.

> 

> Fixes: a4574f63edc6 ("mm/memremap_pages: convert to 'struct range'")

> Reported-by: Hulk Robot <hulkci@huawei.com>

> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>


Pushed to xen/tip.git for-linus-5.13b


Juergen
diff mbox series

Patch

diff --git a/drivers/xen/unpopulated-alloc.c b/drivers/xen/unpopulated-alloc.c
index e64e6befc63b..87e6b7db892f 100644
--- a/drivers/xen/unpopulated-alloc.c
+++ b/drivers/xen/unpopulated-alloc.c
@@ -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) {