Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2520689pxb; Fri, 17 Sep 2021 11:38:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqn91tfptSihbnwqN7sPeq8XFPZOAKUyyzUdqY41D3aWpcaAp5KGDu4cI5vpFQVz6QFqQP X-Received: by 2002:a17:906:a3c3:: with SMTP id ca3mr13919339ejb.337.1631903894614; Fri, 17 Sep 2021 11:38:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631903894; cv=none; d=google.com; s=arc-20160816; b=DbtU70yExWcGBth9rP6CgUwz1Uq81D2GSgqKga2+Xma/MYg+T7PnAaEXAyUsIEaM2G d8jgfGIXehN1y7X55YWtHVDX8iJkq3Bqx5x98DUf/PJbIVadKTLT7k6JyNxwM1Ys+lYC 35y2ZJ+fzuqRXxzSGmBjjnM7FZXD5Jrxv+YYlkAym6pXNTzPPMTOpNy4M/k9En47/ClC 5ttbB9MItsd3TgBQydhk49qNFvITmGoBP0F4Nysp/zIG0o6/9RM3etR1QxiP2P8LDlw3 S6gT9/5IK2goV0Ab90q88pdQGSXEP4Z3qt7OezDh5XyICaHCMmwRVTpwp4bcww76x91H EjSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=8I/7meg9hzcw7tEZzqH2YXfTn0DbCHMjtqTubXnUYqM=; b=LjyveuGfdUk9+2WzL4C3GelrZy/MnAmlvhIU9cvewvsfGlxx4+SefBAJ56zFDLauk8 L5bCSFmt04jxoaeVa/09OCUlJfGhl8QB1GWqNY1SpULuisAs/kDBCKlMJ1JVjJTDPWsS lhoMYj+q3CF/L960vniZYlQj0tLUCgqkKC/is8fmqVCO4ZOXqBfDCq5jP/s/5TrPOblG MItRWPoZ0c3CR00AVdZQMoe6QIadgAj8mFkE2HMHxUQvXn3YOLcmaMANzbVMwhfUsBVN HChHcDbkVbg1CJld/8chuyxYNuJsBwAGxu+diYw/xYgkGV+ar+xxhoU6/DfBbvcIZli3 F7Xw== 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 p15si9638516edj.97.2021.09.17.11.37.28; Fri, 17 Sep 2021 11:38:14 -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 S1343584AbhIQJZl (ORCPT + 99 others); Fri, 17 Sep 2021 05:25:41 -0400 Received: from mail-ua1-f46.google.com ([209.85.222.46]:41827 "EHLO mail-ua1-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245705AbhIQJWu (ORCPT ); Fri, 17 Sep 2021 05:22:50 -0400 Received: by mail-ua1-f46.google.com with SMTP id f24so5688272uav.8; Fri, 17 Sep 2021 02:21:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8I/7meg9hzcw7tEZzqH2YXfTn0DbCHMjtqTubXnUYqM=; b=dbhbZ3+ULfqp1/spGZK77yrmQQ+jygp00REsOYh9oi4neYqM9nvykqIFxeJoQ04+mp g6r4nidWmC+hm8zPUQbD4hOT1HEXJv4zET6K7WayjjpQUO7SUhxXll9FCZzhGO9tpOwb gU0N0p/HEvfkj+La1qsvdNVr8AWKTf7sOsWKMAr1JnZhYmgF9gmTiImoZAL8CPoK+RBK NfGERpaN8Uh7dzvk4zW7C5yMkIG1z+Va3Q7LOXS4wWwK6KeLnx4av8gZS+iNtSosAiHU 2CriEHjBdbSJEFdx90Y9ehnuxvMMOL6nYkjnB3Jdf8aitQEgWQxtJ3X2YqJrCsYpaRxT a/6w== X-Gm-Message-State: AOAM531FJERQQ+EyppXfuTFbrzVL0k0cKemm7zBKywJBy6RIu7cK+/NS FxSGxDN3TVJcJjSHvKHqTeWC5TZ2McQy11d1KDs= X-Received: by 2002:ab0:6dc7:: with SMTP id r7mr3590208uaf.14.1631870481125; Fri, 17 Sep 2021 02:21:21 -0700 (PDT) MIME-Version: 1.0 References: <2c2eef3c9a2f57e5609100a4864715ccf253d30f.1631713483.git.geert+renesas@glider.be> <1acace03-4273-a5ad-50b4-5ab8e3baa551@landley.net> In-Reply-To: <1acace03-4273-a5ad-50b4-5ab8e3baa551@landley.net> From: Geert Uytterhoeven Date: Fri, 17 Sep 2021 11:21:09 +0200 Message-ID: Subject: Re: [PATCH] sh: pgtable-3level: Fix cast to pointer from integer of different size To: Rob Landley Cc: Yoshinori Sato , Rich Felker , "Aneesh Kumar K . V" , Andrew Morton , Jacopo Mondi , Daniel Palmer , Linux-sh list , Linux MM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Rob, On Fri, Sep 17, 2021 at 3:12 AM Rob Landley wrote: > On 9/15/21 8:50 AM, Geert Uytterhoeven wrote: > > arch/sh/include/asm/pgtable-3level.h:37:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] > ... > > The truncation to "unsigned long" has been there since forever, so > > probably it still works fine ;-) > > 1) Linux is LP64 so sizeof(long) and sizeof(pointer) always match, so it's not > truncating. > > 2) The sh5 only ever shipped evaluation units, it never had a production run, > and we haven't implemented j64 yet, so all superh targets are currently 32 bit. > (I.E. it's complaining about _expanding_ the pointer, which shouldn't be a > problem as long as endianness is respected.) The build error is for 32-bit. If CONFIG_X2TLB=y, pgd_t.pgd is "unsigned long long", i.e. 64-bit, so casting it to a pointer needs an intermediate cast to "unsigned long". See arch/sh/include/asm/page.h: #ifdef CONFIG_X2TLB typedef struct { unsigned long pte_low, pte_high; } pte_t; typedef struct { unsigned long long pgprot; } pgprot_t; typedef struct { unsigned long long pgd; } pgd_t; #define pte_val(x) \ ((x).pte_low | ((unsigned long long)(x).pte_high << 32)) #define __pte(x) \ ({ pte_t __pte = {(x), ((unsigned long long)(x)) >> 32}; __pte; }) #else typedef struct { unsigned long pte_low; } pte_t; typedef struct { unsigned long pgprot; } pgprot_t; typedef struct { unsigned long pgd; } pgd_t; #define pte_val(x) ((x).pte_low) #define __pte(x) ((pte_t) { (x) } ) #endif Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds