]> www.infradead.org Git - users/jedix/linux-maple.git/commit
xen: set error code on failures
authorPan Bian <bianpan2016@163.com>
Mon, 5 Dec 2016 08:23:05 +0000 (16:23 +0800)
committerBoris Ostrovsky <boris.ostrovsky@oracle.com>
Fri, 3 Feb 2017 20:55:30 +0000 (15:55 -0500)
commit61341cfcabaf214047dd63d40b410d31545741d3
tree29b6c57b41fccafffe2e3bf9551b4793b24bf822
parent2cd16cada137318a51ef6083b006145d28a2667c
xen: set error code on failures

Variable rc is reset in the loop, and its value will be non-negative
during the second and after repeat of the loop. If it fails to allocate
memory then, it may return a non-negative integer, which indicates no
error. This patch fixes the bug, assigning "-ENOMEM" to rc when
kzalloc() or alloc_page() returns NULL, and removing the initialization
of rc outside of the loop.

Signed-off-by: Pan Bian <bianpan2016@163.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
OraBug: 25497392

(cherry picked from commit 0fdb47440203ce06e09923c4d578cf3c20aef69a)
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
drivers/xen/gntalloc.c