Skip to content

Commit

Permalink
selinux: Remove unnecessary check of array base in selinux_set_mapping()
Browse files Browse the repository at this point in the history
'perms' will never be NULL since it isn't a plain pointer but an array
of u32 values.

This fixes the following warning when building with clang:

security/selinux/ss/services.c:158:16: error: address of array
'p_in->perms' will always evaluate to 'true'
[-Werror,-Wpointer-bool-conversion]
                while (p_in->perms && p_in->perms[k]) {

Signed-off-by: Matthias Kaehlcke <[email protected]>
Signed-off-by: Paul Moore <[email protected]>
  • Loading branch information
Matthias Kaehlcke authored and pcmoore committed Mar 29, 2017
1 parent 2a4c224 commit 342e915
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion security/selinux/ss/services.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ static int selinux_set_mapping(struct policydb *pol,
}

k = 0;
while (p_in->perms && p_in->perms[k]) {
while (p_in->perms[k]) {
/* An empty permission string skips ahead */
if (!*p_in->perms[k]) {
k++;
Expand Down

0 comments on commit 342e915

Please sign in to comment.