Skip to content

Commit

Permalink
selinux: simplify cred_init_security
Browse files Browse the repository at this point in the history
The parameter of selinux_cred() is declared const, so an explicit cast
dropping the const qualifier is not necessary. Without the cast the
local variable cred serves no purpose.

Reported by clang [-Wcast-qual]

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
  • Loading branch information
cgzones authored and pcmoore committed Jan 26, 2022
1 parent 73073d9 commit b084e18
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions security/selinux/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,9 @@ static int selinux_lsm_notifier_avc_callback(u32 event)
*/
static void cred_init_security(void)
{
struct cred *cred = (struct cred *) current->real_cred;
struct task_security_struct *tsec;

tsec = selinux_cred(cred);
tsec = selinux_cred(current->real_cred);
tsec->osid = tsec->sid = SECINITSID_KERNEL;
}

Expand Down

0 comments on commit b084e18

Please sign in to comment.