lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220416042538.472667-1-liqiong@nfschina.com>
Date:   Sat, 16 Apr 2022 12:25:38 +0800
From:   liqiong <liqiong@...china.com>
To:     Peter Zijlstra <peterz@...radead.org>,
        Will Deacon <will@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Marco Elver <elver@...gle.com>,
        "Paul E . McKenney" <paulmck@...nel.org>,
        liqiong <liqiong@...china.com>
Cc:     linux-kernel@...r.kernel.org, yuzhe@...china.com,
        renyu@...china.com
Subject: [PATCH] init: force (struct __rcu *) pointer casting in init_task()

When assign (struct *) pointer to (struct __rcu *) variable,
Sparse warns:
    "incorrect type in initializer (different address spaces)".

Force casting to (struct __ruc *) pointer to fix it.

Signed-off-by: liqiong <liqiong@...china.com>
---
 init/init_task.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/init/init_task.c b/init/init_task.c
index 73cc8f03511a..ba8ff3051cd2 100644
--- a/init/init_task.c
+++ b/init/init_task.c
@@ -104,8 +104,8 @@ struct task_struct init_task
 #endif
 	.ptraced	= LIST_HEAD_INIT(init_task.ptraced),
 	.ptrace_entry	= LIST_HEAD_INIT(init_task.ptrace_entry),
-	.real_parent	= &init_task,
-	.parent		= &init_task,
+	.real_parent	= (struct task_struct __rcu *)&init_task,
+	.parent		= (struct task_struct __rcu *)&init_task,
 	.children	= LIST_HEAD_INIT(init_task.children),
 	.sibling	= LIST_HEAD_INIT(init_task.sibling),
 	.group_leader	= &init_task,
@@ -119,7 +119,7 @@ struct task_struct init_task
 	.io_uring	= NULL,
 #endif
 	.signal		= &init_signals,
-	.sighand	= &init_sighand,
+	.sighand	= (struct sighand_struct __rcu *)&init_sighand,
 	.nsproxy	= &init_nsproxy,
 	.pending	= {
 		.list = LIST_HEAD_INIT(init_task.pending.list),
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ