selinux: simplify cred_init_security
authorChristian Göttsche <cgzones@googlemail.com>
Tue, 25 Jan 2022 14:14:18 +0000 (15:14 +0100)
committerPaul Moore <paul@paul-moore.com>
Wed, 26 Jan 2022 20:57:39 +0000 (15:57 -0500)
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>
security/selinux/hooks.c

index a0243bae842380bd35e256742a55fec35632009f..eae7dbd62df1647e9b68677f7f49e99fea8b26a7 100644 (file)
@@ -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;
 }