linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] LSM: SafeSetID: Fix code specification by scripts/checkpatch.pl
@ 2021-03-10  6:52 Yanwei Gao
  2021-03-15 16:51 ` Micah Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Yanwei Gao @ 2021-03-10  6:52 UTC (permalink / raw)
  To: mortonm, jmorris, serge; +Cc: linux-security-module, Yanwei Gao

First, the code is found to be irregular through checkpatch.pl.
Then I found break is really useless here.

Signed-off-by: Yanwei Gao <gaoyanwei.tx@gmail.com>
---
 security/safesetid/lsm.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/security/safesetid/lsm.c b/security/safesetid/lsm.c
index 8a176b6adbe5..1079c6d54784 100644
--- a/security/safesetid/lsm.c
+++ b/security/safesetid/lsm.c
@@ -125,7 +125,6 @@ static int safesetid_security_capable(const struct cred *cred,
 		pr_warn("Operation requires CAP_SETUID, which is not available to UID %u for operations besides approved set*uid transitions\n",
 			__kuid_val(cred->uid));
 		return -EPERM;
-		break;
 	case CAP_SETGID:
 		/*
 		* If no policy applies to this task, allow the use of CAP_SETGID for
@@ -140,11 +139,9 @@ static int safesetid_security_capable(const struct cred *cred,
 		pr_warn("Operation requires CAP_SETGID, which is not available to GID %u for operations besides approved set*gid transitions\n",
 			__kuid_val(cred->uid));
 		return -EPERM;
-		break;
 	default:
 		/* Error, the only capabilities were checking for is CAP_SETUID/GID */
 		return 0;
-		break;
 	}
 	return 0;
 }
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] LSM: SafeSetID: Fix code specification by scripts/checkpatch.pl
  2021-03-10  6:52 [PATCH] LSM: SafeSetID: Fix code specification by scripts/checkpatch.pl Yanwei Gao
@ 2021-03-15 16:51 ` Micah Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Micah Morton @ 2021-03-15 16:51 UTC (permalink / raw)
  To: Yanwei Gao; +Cc: James Morris, Serge E. Hallyn, linux-security-module

On Tue, Mar 9, 2021 at 8:52 PM Yanwei Gao <gaoyanwei.tx@gmail.com> wrote:
>
> First, the code is found to be irregular through checkpatch.pl.
> Then I found break is really useless here.
>
> Signed-off-by: Yanwei Gao <gaoyanwei.tx@gmail.com>

Thanks for the patch.

I can send it through my tree once the v5.13 merge window opens up.

> ---
>  security/safesetid/lsm.c | 3 ---
>  1 file changed, 3 deletions(-)
>
> diff --git a/security/safesetid/lsm.c b/security/safesetid/lsm.c
> index 8a176b6adbe5..1079c6d54784 100644
> --- a/security/safesetid/lsm.c
> +++ b/security/safesetid/lsm.c
> @@ -125,7 +125,6 @@ static int safesetid_security_capable(const struct cred *cred,
>                 pr_warn("Operation requires CAP_SETUID, which is not available to UID %u for operations besides approved set*uid transitions\n",
>                         __kuid_val(cred->uid));
>                 return -EPERM;
> -               break;
>         case CAP_SETGID:
>                 /*
>                 * If no policy applies to this task, allow the use of CAP_SETGID for
> @@ -140,11 +139,9 @@ static int safesetid_security_capable(const struct cred *cred,
>                 pr_warn("Operation requires CAP_SETGID, which is not available to GID %u for operations besides approved set*gid transitions\n",
>                         __kuid_val(cred->uid));
>                 return -EPERM;
> -               break;
>         default:
>                 /* Error, the only capabilities were checking for is CAP_SETUID/GID */
>                 return 0;
> -               break;
>         }
>         return 0;
>  }
> --
> 2.27.0
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-15 16:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-10  6:52 [PATCH] LSM: SafeSetID: Fix code specification by scripts/checkpatch.pl Yanwei Gao
2021-03-15 16:51 ` Micah Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).