From nobody Thu Jun 18 19:11:48 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74C2DC433EF for ; Sat, 16 Apr 2022 04:26:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230001AbiDPE2i (ORCPT ); Sat, 16 Apr 2022 00:28:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229987AbiDPE2g (ORCPT ); Sat, 16 Apr 2022 00:28:36 -0400 Received: from ha.nfschina.com (unknown [IPv6:2400:dd01:100f:2:72e2:84ff:fe10:5f45]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A3F8D3EBBE for ; Fri, 15 Apr 2022 21:26:05 -0700 (PDT) Received: from localhost (unknown [127.0.0.1]) by ha.nfschina.com (Postfix) with ESMTP id B49BA1E80BE4; Sat, 16 Apr 2022 12:24:19 +0800 (CST) X-Virus-Scanned: amavisd-new at test.com Received: from ha.nfschina.com ([127.0.0.1]) by localhost (ha.nfschina.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GyS6eT-Qc_Kv; Sat, 16 Apr 2022 12:24:17 +0800 (CST) Received: from localhost.localdomain (unknown [180.167.10.98]) (Authenticated sender: liqiong@nfschina.com) by ha.nfschina.com (Postfix) with ESMTPA id 872691E80BE1; Sat, 16 Apr 2022 12:24:16 +0800 (CST) From: liqiong To: Peter Zijlstra , Will Deacon , Mark Rutland , Marco Elver , "Paul E . McKenney" , liqiong Cc: linux-kernel@vger.kernel.org, yuzhe@nfschina.com, renyu@nfschina.com Subject: [PATCH] init: force (struct __rcu *) pointer casting in init_task() Date: Sat, 16 Apr 2022 12:25:38 +0800 Message-Id: <20220416042538.472667-1-liqiong@nfschina.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 --- 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 =3D LIST_HEAD_INIT(init_task.ptraced), .ptrace_entry =3D LIST_HEAD_INIT(init_task.ptrace_entry), - .real_parent =3D &init_task, - .parent =3D &init_task, + .real_parent =3D (struct task_struct __rcu *)&init_task, + .parent =3D (struct task_struct __rcu *)&init_task, .children =3D LIST_HEAD_INIT(init_task.children), .sibling =3D LIST_HEAD_INIT(init_task.sibling), .group_leader =3D &init_task, @@ -119,7 +119,7 @@ struct task_struct init_task .io_uring =3D NULL, #endif .signal =3D &init_signals, - .sighand =3D &init_sighand, + .sighand =3D (struct sighand_struct __rcu *)&init_sighand, .nsproxy =3D &init_nsproxy, .pending =3D { .list =3D LIST_HEAD_INIT(init_task.pending.list), --=20 2.25.1