From 06592d60f00c39a465454df203fcabbdefadb57f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Date: Thu, 28 May 2020 08:20:16 +0000 Subject: [PATCH] xen/control: short circuit xctrl_on_watch_event on spurious event If there's no data to read from xenstore short-circuit xctrl_on_watch_event to return early, there's no reason to continue since the lack of data would prevent matching against any known event type. Sponsored by: Citrix Systems R&D MFC with: r352925 MFC after: 1 week --- sys/dev/xen/control/control.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/xen/control/control.c b/sys/dev/xen/control/control.c index 98ab5bf3a6b..f569b04dd95 100644 --- a/sys/dev/xen/control/control.c +++ b/sys/dev/xen/control/control.c @@ -360,7 +360,7 @@ xctrl_on_watch_event(struct xs_watch *watch, const char **vec, unsigned int len) error = xs_read(XST_NIL, "control", "shutdown", &result_len, (void **)&result); - if (error != 0) + if (error != 0 || result_len == 0) return; /* Acknowledge the request by writing back an empty string. */