Skip to contentSkip to conversation

xen: xenbus: set error code on failure

PATCH Superseded Pan Bian 2 participants 4 messages Dec 5, 2016 – Dec 8, 2016 Xen hypervisor interface

lore
Share & tools
lore

Pan Bian

author
#0 lore raw

PATCH v2 1/1 xen: xenbus: set error code on failure

Variable err is initialized with 0. As a result, the return value may be 0 even if get_zeroed_page() fails to allocate memory. This patch fixes the bug, initializing err with "-ENOMEM".

v1 is reviewed by: Juergen Gross <[email protected]>

---
 drivers/xen/xenbus/xenbus_probe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/xen/xenbus/xenbus_probe.c +1 -1
index 33a31cf..8178d5b 100644
@@ -702,7 +702,7 @@ static int __init xenbus_probe_initcall(void)
  */
 static int __init xenstored_local_init(void)
 {
-	int err = 0;
+	int err = -ENOMEM;
 	unsigned long page = 0;
 	struct evtchn_alloc_unbound alloc_unbound;
 
Signature · 8 lines
1.9.1



_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 5 lines · Pan Bian

Variable err is initialized with 0. As a result, the return value may be 0 even if get_zeroed_page() fails to allocate memory. This patch fixes the bug, initializing err with "-ENOMEM".

v1 is reviewed by: Juergen Gross <[email protected]>

I didn't say so.

Quoted 1 line

Now I do:

Juergen

Quoted 10 lines
---
 drivers/xen/xenbus/xenbus_probe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/xen/xenbus/xenbus_probe.c +0 -0
index 33a31cf..8178d5b 100644

drivers/xen/xenbus/xenbus_probe.c static int __init xenbus_probe_initcall(void) · line 708

Quoted 8 lines
drivers/xen/xenbus/xenbus_probe.c +1 -1
@@ -702,7 +702,7 @@ static int __init xenbus_probe_initcall(void)
  */
 static int __init xenstored_local_init(void)
 {
-	int err = 0;
+	int err = -ENOMEM;
 	unsigned long page = 0;
 	struct evtchn_alloc_unbound alloc_unbound;
 

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

maintainer
#2 lore raw
In reply to Pan Bian
Quoted 7 lines · Pan Bian

Variable err is initialized with 0. As a result, the return value may be 0 even if get_zeroed_page() fails to allocate memory. This patch fixes the bug, initializing err with "-ENOMEM".

v1 is reviewed by: Juergen Gross <[email protected]>

Commited to xen/tip.git for-linus-4.10

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel