--- security/selinux/ss/services.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index e70c7c5d7f26..2dc3189d684c 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c @@ -1927,10 +1927,9 @@ static int convert_context(struct context *oldc, struct context *newc, void *p) args = p; if (oldc->str) { - rc = -ENOMEM; s = kstrdup(oldc->str, GFP_KERNEL); if (!s) - goto out; + return -ENOMEM; rc = string_to_context_struct(args->newp, NULL, s, newc, SECSID_NULL); @@ -1939,20 +1938,18 @@ static int convert_context(struct context *oldc, struct context *newc, void *p) context_init(newc); newc->str = s; newc->len = oldc->len; - rc = 0; - goto out; + return 0; } kfree(s); - if (!rc) { - pr_info("SELinux: Context %s became valid (mapped).\n", - oldc->str); - goto out; - } else { + if (rc) { /* Other error condition, e.g. ENOMEM. */ pr_err("SELinux: Unable to map context %s, rc = %d.\n", oldc->str, -rc); - goto out; + return rc; } + pr_info("SELinux: Context %s became valid (mapped).\n", + oldc->str); + return 0; } context_init(newc); @@ -2015,9 +2012,7 @@ static int convert_context(struct context *oldc, struct context *newc, void *p) goto bad; } - rc = 0; -out: - return rc; + return 0; bad: /* Map old representation to string and save it. */ rc = context_struct_to_string(args->oldp, oldc, &s, &len); @@ -2028,8 +2023,7 @@ bad: newc->len = len; pr_info("SELinux: Context %s became invalid (unmapped).\n", newc->str); - rc = 0; - goto out; + return 0; } static void security_load_policycaps(struct selinux_state *state) -- 2.19.2