selinux: various sparse fixes
Paul Moore
maintainerPATCH 1/1 selinux: various sparse fixes
When running the SELinux code through sparse, there are a handful of warnings. This patch resolves some of these warnings by casting away the "__rcu" attribute in a few core kernel function calls.
% make W=1 C=1 security/selinux/
Signed-off-by Paul Moore <[email protected]>
--- security/selinux/hooks.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
security/selinux/hooks.c +4 -3
@@ -2534,7 +2534,7 @@ static void selinux_bprm_committed_creds(struct linux_binprm *bprm)if (rc) {clear_itimer (); -spin_lock_irq (¤t->sighand->siglock); +spin_lock_irq ((__force spinlock_t *)¤t->sighand->siglock);if (!fatal_signal_pending (current)) {flush_sigqueue (¤t->pending);flush_sigqueue (¤t->signal->shared_pending);
@@ -2542,13 +2542,14 @@ static void selinux_bprm_committed_creds(struct linux_binprm *bprm)sigemptyset (¤t->blocked);recalc_sigpending (); } -spin_unlock_irq (¤t->sighand->siglock); +spin_unlock_irq ((__force spinlock_t *)¤t->sighand->siglock); }/* Wake up the parent if it is waiting so that it can recheck * wait permission to the new task SID. */ read_lock (&tasklist_lock); -__wake_up_parent (current, current->real_parent); +__wake_up_parent (current, + (__force struct task_struct *)current->real_parent);read_unlock (&tasklist_lock); }
Paul Moore
maintainerQuoted 11 lines · Paul Moore
When running the SELinux code through sparse, there are a handful of warnings. This patch resolves some of these warnings by casting away the "
__rcu" attribute in a few core kernel function calls.% make W=1 C=1
security/selinux/Signed-off-by Paul Moore <[email protected]>--- security/selinux/hooks.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
Self NACK as this is likely also a good candidate for the unrcu macro treatment that Ondrej suggested.
Quoted 29 lines
security/selinux/hooks.c +4
-3@@ -2534,7 +2534,7 @@ static void selinux_bprm_committed_creds(struct linux_binprm *bprm)if (rc) {clear_itimer (); -spin_lock_irq (¤t->sighand->siglock); +spin_lock_irq ((__force spinlock_t *)¤t->sighand->siglock);if (!fatal_signal_pending (current)) {flush_sigqueue (¤t->pending);flush_sigqueue (¤t->signal->shared_pending);@@ -2542,13 +2542,14 @@ static void selinux_bprm_committed_creds(struct linux_binprm *bprm)sigemptyset (¤t->blocked);recalc_sigpending (); } -spin_unlock_irq (¤t->sighand->siglock); +spin_unlock_irq ((__force spinlock_t *)¤t->sighand->siglock); }/* Wake up the parent if it is waiting so that it can recheck * wait permission to the new task SID. */ read_lock (&tasklist_lock); -__wake_up_parent (current, current->real_parent); +__wake_up_parent (current, + (__force struct task_struct *)current->real_parent);read_unlock (&tasklist_lock); }
Signature · 1 line
paul-moore.com