[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH for-4.14 v2] tools/xen-ucode: fix error code propagation of microcode load operation


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>
  • Date: Tue, 16 Jun 2020 12:42:34 +0100
  • Authentication-results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>, ian.jackson@xxxxxxxxxxxxx, xadimgnik@xxxxxxxxx, wl@xxxxxxx
  • Delivery-date: Tue, 16 Jun 2020 11:43:14 +0000
  • Ironport-sdr: O2KA83HI7fUTm7TAwZ6nMx1C4u4oC9zA7xkOpFFh++cRCj61rv10i2lCjROsL+hssoDwx9bGyg 9hpE+YOuMmvHyb35yYj9UYKwxSUaeiYhTQ4PQc6J899hrXmlGN2oo+rpeB3EjVhPv1KtbZEeHy +scHh57n+F/1VQjS8DNjGo3jwwnjtXwIOSu8xdfNzaDbss9ap10r/iDBIqUGcwYuMy+HrT/hTY RcZfSdg9fAL52QSYQznj63qbFb+rTW85UxL6dy1AnfVp0gEwxlESAeZ0xfj6LiU/Vh9wLleSev czs=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Otherwise it's impossible to know the reason for a fault or blob rejection
inside the automation.

While at it, also change return code of incorrect invokation to EINVAL.

Signed-off-by: Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>
---
Changes in v2:
- simply call "return errno". On Linux that seems to be safe as values <=255
  are correctly propagated, on non-Linux I couldn't find error codes >127.
- return positive value on incorrect invokation
---
 tools/misc/xen-ucode.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/misc/xen-ucode.c b/tools/misc/xen-ucode.c
index 0c257f4..409cace 100644
--- a/tools/misc/xen-ucode.c
+++ b/tools/misc/xen-ucode.c
@@ -25,7 +25,7 @@ int main(int argc, char *argv[])
         fprintf(stderr,
                 "xen-ucode: Xen microcode updating tool\n"
                 "Usage: %s <microcode blob>\n", argv[0]);
-        return 0;
+        return EINVAL;
     }
 
     filename = argv[1];
@@ -62,8 +62,11 @@ int main(int argc, char *argv[])
 
     ret = xc_microcode_update(xch, buf, len);
     if ( ret )
+    {
         fprintf(stderr, "Failed to update microcode. (err: %s)\n",
                 strerror(errno));
+        return errno;
+    }
 
     xc_interface_close(xch);
 
-- 
2.7.4




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.