diff mbox

[38/52] xen/xsm/flask/flask_op.c: let custom parameter parsing routines return errno

Message ID 20170809070706.13481-39-jgross@suse.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jürgen Groß Aug. 9, 2017, 7:06 a.m. UTC
Modify the custom parameter parsing routines in:

xen/xsm/flask/flask_op.c

to indicate whether the parameter value was parsed successfully.

Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Signed-off-by: Juergen Gross <jgross@suse.com>
---
 xen/xsm/flask/flask_op.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Daniel De Graaf Aug. 9, 2017, 3:31 p.m. UTC | #1
On 08/09/2017 03:06 AM, Juergen Gross wrote:
> Modify the custom parameter parsing routines in:
> 
> xen/xsm/flask/flask_op.c
> 
> to indicate whether the parameter value was parsed successfully.

Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
diff mbox

Patch

diff --git a/xen/xsm/flask/flask_op.c b/xen/xsm/flask/flask_op.c
index 719c2d7efc..35598b5fd8 100644
--- a/xen/xsm/flask/flask_op.c
+++ b/xen/xsm/flask/flask_op.c
@@ -26,7 +26,7 @@ 
 #define _copy_from_guest copy_from_guest
 
 enum flask_bootparam_t __read_mostly flask_bootparam = FLASK_BOOTPARAM_ENFORCING;
-static void parse_flask_param(char *s);
+static int parse_flask_param(char *s);
 custom_param("flask", parse_flask_param);
 
 bool_t __read_mostly flask_enforcing = 1;
@@ -58,7 +58,7 @@  static int flask_security_make_bools(void);
 
 extern int ss_initialized;
 
-static void __init parse_flask_param(char *s)
+static int __init parse_flask_param(char *s)
 {
     if ( !strcmp(s, "enforcing") )
         flask_bootparam = FLASK_BOOTPARAM_ENFORCING;
@@ -70,6 +70,8 @@  static void __init parse_flask_param(char *s)
         flask_bootparam = FLASK_BOOTPARAM_PERMISSIVE;
     else
         flask_bootparam = FLASK_BOOTPARAM_INVALID;
+
+    return (flask_bootparam == FLASK_BOOTPARAM_INVALID) ? -EINVAL : 0;
 }
 
 static int domain_has_security(struct domain *d, u32 perms)