Skip to content

Commit fd781f4

Browse files
Jiapeng Chongpcmoore
authored andcommitted
selinux: Remove redundant assignment to rc
Variable rc is set to '-EINVAL' but this value is never read as it is overwritten or not used later on, hence it is a redundant assignment and can be removed. Cleans up the following clang-analyzer warning: security/selinux/ss/services.c:2103:3: warning: Value stored to 'rc' is never read [clang-analyzer-deadcode.DeadStores]. security/selinux/ss/services.c:2079:2: warning: Value stored to 'rc' is never read [clang-analyzer-deadcode.DeadStores]. security/selinux/ss/services.c:2071:2: warning: Value stored to 'rc' is never read [clang-analyzer-deadcode.DeadStores]. security/selinux/ss/services.c:2062:2: warning: Value stored to 'rc' is never read [clang-analyzer-deadcode.DeadStores]. security/selinux/ss/policydb.c:2592:3: warning: Value stored to 'rc' is never read [clang-analyzer-deadcode.DeadStores]. Reported-by: Abaci Robot <[email protected]> Signed-off-by: Jiapeng Chong <[email protected]> Signed-off-by: Paul Moore <[email protected]>
1 parent 7cffc37 commit fd781f4

File tree

2 files changed

+0
-5
lines changed

2 files changed

+0
-5
lines changed

security/selinux/ss/policydb.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2589,7 +2589,6 @@ int policydb_read(struct policydb *p, void *fp)
25892589
if (rc)
25902590
goto bad;
25912591

2592-
rc = -EINVAL;
25932592
rtk->role = le32_to_cpu(buf[0]);
25942593
rtk->type = le32_to_cpu(buf[1]);
25952594
rtd->new_role = le32_to_cpu(buf[2]);

security/selinux/ss/services.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2060,7 +2060,6 @@ static int convert_context(struct context *oldc, struct context *newc, void *p)
20602060
context_init(newc);
20612061

20622062
/* Convert the user. */
2063-
rc = -EINVAL;
20642063
usrdatum = symtab_search(&args->newp->p_users,
20652064
sym_name(args->oldp,
20662065
SYM_USERS, oldc->user - 1));
@@ -2069,15 +2068,13 @@ static int convert_context(struct context *oldc, struct context *newc, void *p)
20692068
newc->user = usrdatum->value;
20702069

20712070
/* Convert the role. */
2072-
rc = -EINVAL;
20732071
role = symtab_search(&args->newp->p_roles,
20742072
sym_name(args->oldp, SYM_ROLES, oldc->role - 1));
20752073
if (!role)
20762074
goto bad;
20772075
newc->role = role->value;
20782076

20792077
/* Convert the type. */
2080-
rc = -EINVAL;
20812078
typdatum = symtab_search(&args->newp->p_types,
20822079
sym_name(args->oldp,
20832080
SYM_TYPES, oldc->type - 1));
@@ -2101,7 +2098,6 @@ static int convert_context(struct context *oldc, struct context *newc, void *p)
21012098
oc = args->newp->ocontexts[OCON_ISID];
21022099
while (oc && oc->sid[0] != SECINITSID_UNLABELED)
21032100
oc = oc->next;
2104-
rc = -EINVAL;
21052101
if (!oc) {
21062102
pr_err("SELinux: unable to look up"
21072103
" the initial SIDs list\n");

0 commit comments

Comments
 (0)