Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1096024pxb; Fri, 15 Apr 2022 21:26:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTmSFb5wcV4dZUk2NT6K7tlwo3zLIJAtiAHxNbxamM0gMjCa5DLyiyNLSxhBFELcDWqCdr X-Received: by 2002:a17:90a:4417:b0:1ca:a861:3fbf with SMTP id s23-20020a17090a441700b001caa8613fbfmr7581675pjg.80.1650083176842; Fri, 15 Apr 2022 21:26:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650083176; cv=none; d=google.com; s=arc-20160816; b=rUtCFd3NAVRQdXcolVTbpmEBd+f/GNa/+1EZpuxSkT2UmcxZxlT6hez162P37CUprc MyLKn53KgIP0xyHfLi0SzWMpzs2n2qF43MZ0Vw2tDqXuEq77e2TssRXONrWpymUT+/pe 0t4eGX8q//O/UXu/fu4p/fFzxpLktrG0ef8t6bjIrjRjrF6R9YGieFHQJ9DCvn5BAtqi JKPFXbBUWtRBLms7EolI1ht2ulLQzuaClkws5taxTwxTWGnMyj9rs5EcdSjd0wcjtUfV HPLmlT2MepRzcKOGw+OL2mve7N6ekK79qJVPUuT1D7ynBBQmI02QJnzmftWsUyU0nI9t i9mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=pqx64AyolsgjrH+LHsYNWRj6/0r+S3yqa5W0JwQ0XN8=; b=gFD03N0o+ZoKUEkNO0QmP6dqR5KWinc+HX2HOZU0y1zIHRsVCsltVuAhHbWeK4w8We YDRwX0RSSc79D+bTEAJBJt8/iDsFq8DqR8PVgdxbeJ5xYeffPd6GfAweYaY16d7oB/4e QlbWA9xBjftxG6xW9pdSlOnFs8HyQYGd/S3QUOIpJ5Y2h8nF93dE3zeJRTWYDZpcuiw0 9fhONcDx08qsLSi9te/LvcNYKZ/P1BG0humvsGyySEnVfflRjv8iooCvOo8GALe4+d5M krqyVx9aNBsop6+MlmRNBQFrxxnQuKE0EEQCJr45cH5QiieDYp8G9ePr7iAPRxLupWhT nYEQ== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id b18-20020a639312000000b0039da754b1a1si2992103pge.151.2022.04.15.21.26.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 21:26:16 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1ABCBFDE15; Fri, 15 Apr 2022 21:26:15 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229998AbiDPE2i (ORCPT + 99 others); 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: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 = 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