Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp496848pxb; Wed, 15 Sep 2021 06:54:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWGkH3iqaUm8iKNsoZGhiVn+fbm4BQT8SJHavN09SJEYPcqc3Ek3rirZ90oaEj3ggZ1zIl X-Received: by 2002:a5e:d80a:: with SMTP id l10mr126036iok.36.1631714068333; Wed, 15 Sep 2021 06:54:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631714068; cv=none; d=google.com; s=arc-20160816; b=osR7zVX3kqbCsXOmFkaWOWP/s9TPD56trpMrXlPY0PYrlK9T0yoT7an4AlQhfrKHEZ +qSe7ftqpxjvqse65m2ggzyqaZEC0/i1Ia147WuZ0reGRY6Alv5M1pOW+abBcDVUDQce wx69yktJJJs6vSdASA98i0U2GY+3siP/ySek+hqv+UPVEbTEYvV2lMy5x1Y2jIdnMrUR 9hVTjdogvgHj7MvGu0faaREnbSrodoQiSIIWZA94YeasN3uNAjwgCwDcsHsoCFkGLBgv lp9cJY30Wbynf2hi8mPAROZR4qvRDh9iAhPGJY9SsMtnciJtgweo1Zs564roZ1pHkL2T PW3g== 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=jJwASjaYA82zf9Buk1cXyfflbL1GHn0rjHGX8j0dBpE=; b=tB11ArK1lvdBzy1LUOgMPf6lVEv8m78VmFtR/+3/TIWD4UgthqPLmu1OApa9uWMsGE Dev4Qq6UGGqIykJEisjeYV0r6Ma0FMOzjH4JChH53nyTPzPgSYScaRT34PExlCTEI3nS d71sGpGiy1DNxq1ZKC++BEySe0pkceFJ8bND/+uYPKWfvj2aNGepSq3smrnHzrXnoQuP GS74R5YZO6fqiQN4KVrfwvV21VaJJBiJCAsvLS+iVu2913kVkjNmh92D6Ipv1kq9fpQc QISr9LV4Ww6XRm4aH+riMzKk7fTCkrtyUiYkZJtelFkGjV5SQRgR5+QGFEbmmoBlD9IV uC7A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r19si23365ilh.119.2021.09.15.06.54.16; Wed, 15 Sep 2021 06:54:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235122AbhIONxj (ORCPT + 99 others); Wed, 15 Sep 2021 09:53:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234504AbhIONxi (ORCPT ); Wed, 15 Sep 2021 09:53:38 -0400 Received: from michel.telenet-ops.be (michel.telenet-ops.be [IPv6:2a02:1800:110:4::f00:18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B775C061574 for ; Wed, 15 Sep 2021 06:52:19 -0700 (PDT) Received: from ramsan.of.borg ([84.195.186.194]) by michel.telenet-ops.be with bizsmtp id uDsG2500Q4C55Sk06DsG5V; Wed, 15 Sep 2021 15:52:17 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1mQVIc-004ejN-9q; Wed, 15 Sep 2021 15:50:06 +0200 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1mQVIb-002pMg-Qd; Wed, 15 Sep 2021 15:50:05 +0200 From: Geert Uytterhoeven To: Yoshinori Sato , Rich Felker , "Aneesh Kumar K . V" , Andrew Morton Cc: Jacopo Mondi , Daniel Palmer , linux-sh@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] sh: pgtable-3level: Fix cast to pointer from integer of different size Date: Wed, 15 Sep 2021 15:50:04 +0200 Message-Id: <2c2eef3c9a2f57e5609100a4864715ccf253d30f.1631713483.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If X2TLB=y (CPU_SHX2=y or CPU_SHX3=y, e.g. migor_defconfig), pgd_t.pgd is "unsigned long long", causing: In file included from arch/sh/include/asm/pgtable.h:13, from include/linux/pgtable.h:6, from include/linux/mm.h:33, from arch/sh/kernel/asm-offsets.c:14: arch/sh/include/asm/pgtable-3level.h: In function ‘pud_pgtable’: arch/sh/include/asm/pgtable-3level.h:37:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] 37 | return (pmd_t *)pud_val(pud); | ^ Fix this by adding an intermediate cast to "unsigned long", which is basically what the old code did before. Fixes: 9cf6fa2458443118 ("mm: rename pud_page_vaddr to pud_pgtable and make it return pmd_t *") Signed-off-by: Geert Uytterhoeven --- Compile-tested only, as the remote Migo-R is MIA. Anyone with e.g. a Migo-R or Ecovec to boot-test? The truncation to "unsigned long" has been there since forever, so probably it still works fine ;-) ... once the other build issues are fixed. --- arch/sh/include/asm/pgtable-3level.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/sh/include/asm/pgtable-3level.h b/arch/sh/include/asm/pgtable-3level.h index 56bf35c2f29c2b83..cdced80a7ffa3944 100644 --- a/arch/sh/include/asm/pgtable-3level.h +++ b/arch/sh/include/asm/pgtable-3level.h @@ -34,7 +34,7 @@ typedef struct { unsigned long long pmd; } pmd_t; static inline pmd_t *pud_pgtable(pud_t pud) { - return (pmd_t *)pud_val(pud); + return (pmd_t *)(unsigned long)pud_val(pud); } /* only used by the stubbed out hugetlb gup code, should never be called */ -- 2.25.1