Skip to contentSkip to conversation

LSM: SafeSetID: Fix code specification by scripts/checkpatch.pl

PATCH In review Yanwei Gao 2 participants 2 messages Mar 10, 2021 – Mar 15, 2021

Subsystems (2)
lore
Share & tools
lore

Yanwei Gao

author
#0 lore raw

PATCH 1/1 LSM: SafeSetID: Fix code specification by scripts/checkpatch.pl

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

---
 security/safesetid/lsm.c | 3 ---
 1 file changed, 3 deletions(-)
security/safesetid/lsm.c +0 -3
index 8a176b6adbe5..1079c6d54784 100644
@@ -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;
 }
Signature · 1 line
2.27.0
maintainer
#1 lore raw
Quoted 5 lines · Yanwei Gao

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

Thanks for the patch.

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

Quoted 31 lines
---
 security/safesetid/lsm.c | 3 ---
 1 file changed, 3 deletions(-)
security/safesetid/lsm.c +0 -4
index 8a176b6adbe5..1079c6d54784 100644
@@ -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