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

[PATCH 2/5] libxl: drop dead assignments to "ret" from libxl__domain_config_setdefault()


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 12 Jun 2023 13:46:19 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+dDuzZO3NY+2JEelv9HlCc27GL3IfXBwOaXL4IVoUlc=; b=Tgx4oLAGyXtu9R+WofTZ1vIT2GoJVcxQAN8E2tc1TU8i0I6pQoFYBiRTTsk+B47GocdxiBRKMmBW2x+xxBS298QJCU/7muajlfIkvHyA6IVQ6eQQULAMlpRSMXZ+0IT+Jxs/C2jX8MIOZQO0R/NL9gv9OevhfrOm6l6hbammN+50ig1lamLCIsIsd+9Z4bvVSfieES3jo/GmXAUhtbGGiPHqzbhmro2fBxFFyuUVGmpAL6wvknGhSZ3yaxLXcEdGvcdwnkKyxJbrCnIiEC4bQ54BcGf2mXTSLcHJh1qsKQg9voLLZo2vkTr4hT0TkPQgiHgnsO2Tb3zryWrxhPQ+Qw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cuBb1RoVDyFLwaSn2pW2mdhS103q6yLgOy/dymeMaq/6vbJATYYM8L/WP1xmRtbK5+O4uNT8dFOak4OMWC7mH3HU/I67paXlVEntc3iz8ku9CsjcF3GV+PqvOdoGLRAhk8IB1Fda79fdV7kV8jG5cKwfdYiOTqcHypxpzstve8cHDTIx1JMIpHALk8LlywZYDpm7FbE+Gt4cDhdM9WGFflJnlsG85eeh+oPEsOGntZ2aMshsCdhSCqbNMkkV9+Tdr4/JsxVu6A7/1sxHVQiYm2IyfkbKOanDbVFw622P0ARBLU0XszHjAUeJ2Io17aGfE4p2/CLs/teIWH6vwWrrTA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Anthony Perard <anthony.perard@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Daniel Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 12 Jun 2023 11:46:31 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

The variable needs to be properly set only on the error paths.

Coverity ID: 1532311
Fixes: ab4440112bec ("xl / libxl: push parsing of SSID and CPU pool ID down to 
libxl")
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
If XSM is disabled, is it really useful to issue the 2nd and 3rd calls
if the 1st yielded ENOSYS?

--- a/tools/libs/light/libxl_create.c
+++ b/tools/libs/light/libxl_create.c
@@ -1081,13 +1079,12 @@ int libxl__domain_config_setdefault(libx
         ret = libxl_flask_context_to_sid(ctx, s, strlen(s),
                                          &d_config->c_info.ssidref);
         if (ret) {
-            if (errno == ENOSYS) {
-                LOGD(WARN, domid, "XSM Disabled: init_seclabel not supported");
-                ret = 0;
-            } else {
+            if (errno != ENOSYS) {
                 LOGD(ERROR, domid, "Invalid init_seclabel: %s", s);
                 goto error_out;
             }
+
+            LOGD(WARN, domid, "XSM Disabled: init_seclabel not supported");
         }
     }
 
@@ -1096,13 +1093,12 @@ int libxl__domain_config_setdefault(libx
         ret = libxl_flask_context_to_sid(ctx, s, strlen(s),
                                          &d_config->b_info.exec_ssidref);
         if (ret) {
-            if (errno == ENOSYS) {
-                LOGD(WARN, domid, "XSM Disabled: seclabel not supported");
-                ret = 0;
-            } else {
+            if (errno != ENOSYS) {
                 LOGD(ERROR, domid, "Invalid seclabel: %s", s);
                 goto error_out;
             }
+
+            LOGD(WARN, domid, "XSM Disabled: seclabel not supported");
         }
     }
 
@@ -1111,14 +1107,13 @@ int libxl__domain_config_setdefault(libx
         ret = libxl_flask_context_to_sid(ctx, s, strlen(s),
                                          
&d_config->b_info.device_model_ssidref);
         if (ret) {
-            if (errno == ENOSYS) {
-                LOGD(WARN, domid,
-                     "XSM Disabled: device_model_stubdomain_seclabel not 
supported");
-                ret = 0;
-            } else {
+            if (errno != ENOSYS) {
                 LOGD(ERROR, domid, "Invalid device_model_stubdomain_seclabel: 
%s", s);
                 goto error_out;
             }
+
+            LOGD(WARN, domid,
+                 "XSM Disabled: device_model_stubdomain_seclabel not 
supported");
         }
     }
 




 


Rackspace

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