Skip to content

Commit 4e551db

Browse files
WOnder93pcmoore
authored andcommitted
selinux: clarify return code in filename_trans_read_helper_compat()
For the "conflicting/duplicate rules" branch in filename_trans_read_helper_compat() the Smatch static checker reports: security/selinux/ss/policydb.c:1953 filename_trans_read_helper_compat() warn: missing error code 'rc' While the value of rc will already always be zero here, it is not obvious that it's the case and that it's the intended return value (Smatch expects rc to be assigned within 5 lines from the goto). Therefore, add an explicit assignment just before the goto to make the intent more clear and the code less error-prone. Fixes: c3a2761 ("selinux: optimize storage of filename transitions") Reported-by: Dan Carpenter <[email protected]> Link: https://lore.kernel.org/selinux/[email protected]/ Signed-off-by: Ondrej Mosnacek <[email protected]> Signed-off-by: Paul Moore <[email protected]>
1 parent abb0f43 commit 4e551db

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

security/selinux/ss/policydb.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1950,6 +1950,7 @@ static int filename_trans_read_helper_compat(struct policydb *p, void *fp)
19501950
if (unlikely(ebitmap_get_bit(&datum->stypes, stype - 1))) {
19511951
/* conflicting/duplicate rules are ignored */
19521952
datum = NULL;
1953+
rc = 0;
19531954
goto out;
19541955
}
19551956
if (likely(datum->otype == otype))

0 commit comments

Comments
 (0)