linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] security: remove unneeded break
@ 2020-10-19 17:36 trix
  2020-10-20  1:43 ` James Morris
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: trix @ 2020-10-19 17:36 UTC (permalink / raw)
  To: zohar, dmitry.kasatkin, jmorris, serge, jejb, jarkko.sakkinen,
	dhowells, mortonm
  Cc: linux-integrity, linux-security-module, linux-kernel, keyrings, Tom Rix

From: Tom Rix <trix@redhat.com>

A break is not needed if it is preceded by a return

Signed-off-by: Tom Rix <trix@redhat.com>
---
 security/integrity/ima/ima_appraise.c     | 1 -
 security/keys/trusted-keys/trusted_tpm1.c | 1 -
 security/safesetid/lsm.c                  | 3 ---
 3 files changed, 5 deletions(-)

diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c
index 3dd8c2e4314e..f400a6122b3c 100644
--- a/security/integrity/ima/ima_appraise.c
+++ b/security/integrity/ima/ima_appraise.c
@@ -181,7 +181,6 @@ enum hash_algo ima_get_hash_algo(struct evm_ima_xattr_data *xattr_value,
 		if (sig->version != 2 || xattr_len <= sizeof(*sig))
 			return ima_hash_algo;
 		return sig->hash_algo;
-		break;
 	case IMA_XATTR_DIGEST_NG:
 		/* first byte contains algorithm id */
 		ret = xattr_value->data[0];
diff --git a/security/keys/trusted-keys/trusted_tpm1.c b/security/keys/trusted-keys/trusted_tpm1.c
index b9fe02e5f84f..eddc9477d42a 100644
--- a/security/keys/trusted-keys/trusted_tpm1.c
+++ b/security/keys/trusted-keys/trusted_tpm1.c
@@ -901,7 +901,6 @@ static int datablob_parse(char *datablob, struct trusted_key_payload *p,
 		break;
 	case Opt_err:
 		return -EINVAL;
-		break;
 	}
 	return ret;
 }
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.18.1


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

* Re: [PATCH] security: remove unneeded break
  2020-10-19 17:36 [PATCH] security: remove unneeded break trix
@ 2020-10-20  1:43 ` James Morris
  2020-10-20 20:45 ` Mimi Zohar
  2020-10-27  1:24 ` Jarkko Sakkinen
  2 siblings, 0 replies; 4+ messages in thread
From: James Morris @ 2020-10-20  1:43 UTC (permalink / raw)
  To: Tom Rix
  Cc: zohar, dmitry.kasatkin, serge, jejb, jarkko.sakkinen, dhowells,
	mortonm, linux-integrity, linux-security-module, linux-kernel,
	keyrings

On Mon, 19 Oct 2020, trix@redhat.com wrote:

> From: Tom Rix <trix@redhat.com>
> 
> A break is not needed if it is preceded by a return
> 
> Signed-off-by: Tom Rix <trix@redhat.com>


Acked-by: James Morris <jamorris@linux.microsoft.com>



-- 
James Morris
<jmorris@namei.org>


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

* Re: [PATCH] security: remove unneeded break
  2020-10-19 17:36 [PATCH] security: remove unneeded break trix
  2020-10-20  1:43 ` James Morris
@ 2020-10-20 20:45 ` Mimi Zohar
  2020-10-27  1:24 ` Jarkko Sakkinen
  2 siblings, 0 replies; 4+ messages in thread
From: Mimi Zohar @ 2020-10-20 20:45 UTC (permalink / raw)
  To: trix, dmitry.kasatkin, jmorris, serge, jejb, jarkko.sakkinen,
	dhowells, mortonm
  Cc: linux-integrity, linux-security-module, linux-kernel, keyrings

On Mon, 2020-10-19 at 10:36 -0700, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
> 
> A break is not needed if it is preceded by a return
> 
> Signed-off-by: Tom Rix <trix@redhat.com>

Recently "fall through" comments were added before any case statement
without a preceeding break.  Have you made sure these changes won't be
flagged.   Assuming you have,

Acked-by: Mimi Zohar <zohar@linux.ibm.com>

Mimi


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

* Re: [PATCH] security: remove unneeded break
  2020-10-19 17:36 [PATCH] security: remove unneeded break trix
  2020-10-20  1:43 ` James Morris
  2020-10-20 20:45 ` Mimi Zohar
@ 2020-10-27  1:24 ` Jarkko Sakkinen
  2 siblings, 0 replies; 4+ messages in thread
From: Jarkko Sakkinen @ 2020-10-27  1:24 UTC (permalink / raw)
  To: trix
  Cc: zohar, dmitry.kasatkin, jmorris, serge, jejb, dhowells, mortonm,
	linux-integrity, linux-security-module, linux-kernel, keyrings

On Mon, Oct 19, 2020 at 10:36:53AM -0700, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
> 
> A break is not needed if it is preceded by a return
> 
> Signed-off-by: Tom Rix <trix@redhat.com>

Acked-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

/Jarkko

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

end of thread, other threads:[~2020-10-27  1:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-19 17:36 [PATCH] security: remove unneeded break trix
2020-10-20  1:43 ` James Morris
2020-10-20 20:45 ` Mimi Zohar
2020-10-27  1:24 ` Jarkko Sakkinen

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).