From patchwork Thu Oct 31 15:09:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 178203 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2980573ill; Thu, 31 Oct 2019 08:11:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqzjVD2+tVyCzq9mOV9x7qBO5MejbIb4VAJLI1WdL8HpcRAyEIOmucaeQ3vuwNNnkBAHzRh3 X-Received: by 2002:a92:5d8d:: with SMTP id e13mr6832888ilg.32.1572534695319; Thu, 31 Oct 2019 08:11:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572534695; cv=none; d=google.com; s=arc-20160816; b=lVgP5OarwLZpJtvvduQ7G1zBppUFBI8D0wz5uP3EHHX72Ex4+u+/QZuQz5Vv54m0gb GmeYkeIEaNCnkOxODW8c8Ba7BZAZXe5bYxyouEla3G5QJemaNBvr3+QKIn7XleBcSGo6 56bNyAl5FYtNe3YTR0Qf2Fy3Bbb5rJ7bU31fcQam077UcxAI+UYh/rmOVjqBKx/dwan3 kA+sAwdxH0eJjmpSUF2Rbr3M9e4kW58N3VbiknytMSgERUWujspir88PBfRv9YJ4flj0 LFLgqTJv6rnlwMo4O0ePrOsc4jTTsoKsVxGtVapKVY8nqwHPzTHYPtI+a2WFXsV0AXyF pupA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from; bh=fJVjdsJTVqVVDY435vCdCro4LAz3EELP/VXIlZcXwJg=; b=rPzYnoMlClnT/kXFH1GKiBPdWNYuaSS7Z0ve92e3aqc668SSxVHEZeZeB3UX47m63q sH8uocW1gkda5EpgVJQAnvv35zS1uMxWRY0smbkgasLUFA3vdK0VkVguJp31O3bDzpUJ G2aS6Uaq6KU1lStUnAqUDl5jnrCaeLVCKvkQR2eWod+nOa1XwWwuH8kpI8Z2J6DPhmi4 LAbFV54AVHOi0QJukwA/xUARMPyWBa9WaBbDbjrFEfbCFRCxOZ8abMfMHlpT289wwbYt TbKWBFxzGcK74qc82XK/GTLW4Eo7ELOTYgW+n94QMP4cBe6z1Fdy2AhfoYmZ1lxQmSQu i1fw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id h18si7097122iog.106.2019.10.31.08.11.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 31 Oct 2019 08:11:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iQC5T-0007Ow-V1; Thu, 31 Oct 2019 15:10:11 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iQC5S-0007N3-BX for xen-devel@lists.xenproject.org; Thu, 31 Oct 2019 15:10:10 +0000 X-Inumbo-ID: 7ac3ffc6-fbf0-11e9-954c-12813bfff9fa Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 7ac3ffc6-fbf0-11e9-954c-12813bfff9fa; Thu, 31 Oct 2019 15:09:48 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E95CE4F5; Thu, 31 Oct 2019 08:09:47 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (unknown [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 09E493F71E; Thu, 31 Oct 2019 08:09:46 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Thu, 31 Oct 2019 15:09:15 +0000 Message-Id: <20191031150922.22938-13-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191031150922.22938-1-julien.grall@arm.com> References: <20191031150922.22938-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH for-4.13 v4 12/19] xen/arm: traps: Don't ignore invalid value for serrors= X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: jgross@suse.com, Volodymyr Babchuk , Julien Grall , Stefano Stabellini , Julien Grall MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" serrors= only supports 3 values "diverse", "forward" and "panic". The current implementation of parse_serrors_behavior() will default to "diverse" for any invalid value and not tell the users. Rather than ignore the invalid input, return an error to the caller so it can decides the be approach. This will be useful after a follow-up patch where the number of options will be reduced. Take the opportunity to initialize serrors_op to SERRORS_DIVERSE rather than relying on the item to be the first in the enum and therefore equal to 0. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellin --- Changes in v3: - Add Stefano's reviewed-by Changes in v2: - Patch added --- xen/arch/arm/traps.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index cb4e3b627b..d028ec9224 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -104,14 +104,16 @@ register_t get_default_hcr_flags(void) static enum { SERRORS_DIVERSE, SERRORS_PANIC, -} serrors_op; +} serrors_op = SERRORS_DIVERSE; static int __init parse_serrors_behavior(const char *str) { if ( !strcmp(str, "panic") ) serrors_op = SERRORS_PANIC; - else + else if ( !strcmp(str, "diverse") ) serrors_op = SERRORS_DIVERSE; + else + return -EINVAL; return 0; }