[PATCH] xen/manage: correct return value check on xenbus_scanf()

From: Jan Beulich
Date: Thu Jul 07 2016 - 03:42:25 EST


Only a positive return value indicates success.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
drivers/xen/manage.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- 4.7-rc6-xenbus_scanf.orig/drivers/xen/manage.c
+++ 4.7-rc6-xenbus_scanf/drivers/xen/manage.c
@@ -275,7 +275,7 @@ static void sysrq_handler(struct xenbus_
err = xenbus_transaction_start(&xbt);
if (err)
return;
- if (!xenbus_scanf(xbt, "control", "sysrq", "%c", &sysrq_key)) {
+ if (xenbus_scanf(xbt, "control", "sysrq", "%c", &sysrq_key) <= 0) {
pr_err("Unable to read sysrq code in control/sysrq\n");
xenbus_transaction_end(xbt, 1);
return;