xenbus: check return value of xenbus_scanf()

Don't ignore errors here: Set backend state to unknown when
unsuccessful.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
This commit is contained in:
Jan Beulich 2016-10-24 09:05:18 -06:00 committed by David Vrabel
parent e1e5b3ff41
commit c251f15c7d
1 changed files with 3 additions and 1 deletions

View File

@ -335,7 +335,9 @@ static int backend_state;
static void xenbus_reset_backend_state_changed(struct xenbus_watch *w, static void xenbus_reset_backend_state_changed(struct xenbus_watch *w,
const char **v, unsigned int l) const char **v, unsigned int l)
{ {
xenbus_scanf(XBT_NIL, v[XS_WATCH_PATH], "", "%i", &backend_state); if (xenbus_scanf(XBT_NIL, v[XS_WATCH_PATH], "", "%i",
&backend_state) != 1)
backend_state = XenbusStateUnknown;
printk(KERN_DEBUG "XENBUS: backend %s %s\n", printk(KERN_DEBUG "XENBUS: backend %s %s\n",
v[XS_WATCH_PATH], xenbus_strstate(backend_state)); v[XS_WATCH_PATH], xenbus_strstate(backend_state));
wake_up(&backend_state_wq); wake_up(&backend_state_wq);