Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp496746pxb; Wed, 8 Sep 2021 06:07:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtz5PAyTgfjrFwJ9GNN8Y+D9l7u8uzOCpey+7bmpk68Ayzgj8NHLvv1OE2Gk54F1+kFFmR X-Received: by 2002:a92:cd05:: with SMTP id z5mr968384iln.206.1631106425792; Wed, 08 Sep 2021 06:07:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631106425; cv=none; d=google.com; s=arc-20160816; b=tG0OHq5y6OVKllHEYv5rUucxLTOJbNW3eqIJLjHRwKOsbiM9822qtplG4wFRJjqgXy IBbn+k60PDJnpptkuIOEwyZknOn1bUyAtAdC+AtAMhwa7nsCstodh69x3EDNmzz/+ec3 AlP/zoId4h65xeSDRfUsQVzjX6fgklOSdW/TcSoaYRhdKFXMti6ych4LrJiLgeEo7e9+ dPi6jERjZyDpZBA3i0+sS04MsYFC89tOE3vrgqBOP5OAqQcgvLgOdz21TQMA0LIDjGcL dbfgjx5YeDizckhPtsz0mr4erkrV4ohJQA7+5TGivubgBee3FjEXZZJ/m7lkumMm1q9s aypg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:subject:from :references:cc:to:sender:dkim-signature; bh=v3tm0ULGt1MLK9wjIrtCbRkaasSMHbIa3xYVDcCKc4g=; b=ELd+yGiHoWOO6oG0B3S/tj1vWw+QWlQge2gbFT7o9Z4NYIcSjaDPaGRdmVmf31zMLl t0bSAq6ecBfuPvfeRczHw3H4Wf+kjrvo1CjNNgMizdEZ+wut12IphY19xmxHLVfNrDtw vVzB/VbLJ+sJ+De57P42EPKfaLcDyYAXeWJN1H7EJKqPEP2+CVeDjaA/hQzel/iELBk7 Uj/X+sias8OsDbJ+SrA3wOfcMjTaB/GljOualYri0PG6couBzf1YlCjU2mUMaOrpW9ff SaklAN+MiTgYj2R3PeVF+6BKfjtuxeoWXkIxVwxL+iZ2xKfNExBBqvzZzMkFSFVjU4cd MdMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=DDn6Ldv2; 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 h25si2092408ioj.39.2021.09.08.06.06.52; Wed, 08 Sep 2021 06:07:05 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=DDn6Ldv2; 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 S243535AbhIHMnm (ORCPT + 99 others); Wed, 8 Sep 2021 08:43:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234005AbhIHMnl (ORCPT ); Wed, 8 Sep 2021 08:43:41 -0400 Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E862CC061575; Wed, 8 Sep 2021 05:42:33 -0700 (PDT) Received: by mail-ot1-x32b.google.com with SMTP id i3-20020a056830210300b0051af5666070so2757157otc.4; Wed, 08 Sep 2021 05:42:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:to:cc:references:from:subject:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=v3tm0ULGt1MLK9wjIrtCbRkaasSMHbIa3xYVDcCKc4g=; b=DDn6Ldv2rEO//8YdRF+nEg4zSXuj/3qhUGw+UYAW+VPxQdERfT921hOkCGUhepN2Zz XuOriVj5nVbM0seJa++BtfRuEdujt/U9WqIC8i1G5usKQImpVLW15t2/AJeDUx7WZx0W OgJ0j+P+b6rjNLxq9QZRBrET6HJ2XnB2bYyZizWCOw4vVBHuhS5xawbdE0zqtjqiyypu YieurUNJtPx1uP4TiYj7QDmQ1mEywY3MZNhLBscvvQ2qyQlLbViMXuu9iMXgZq4b0tvc qAAdEVu/+IuiiN8dhuj1S+z//9JJgmCoz2lnMOBvmtK48lBWXlG5ZVlr0RfLB+xXV4lu tWqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:to:cc:references:from:subject:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=v3tm0ULGt1MLK9wjIrtCbRkaasSMHbIa3xYVDcCKc4g=; b=qkxFFttqG0qIDqmhyn3IWZ5eBazeUTTlcsaQP+GhEAqhRpxL3nULiI4entfF2+NVZi J2JE7Qy9EcVxP4YdkgmFCVxYZYraeY13CQ95tjIc6n+NidBf+9WNziHvV4ygONloPE7s hRhwH0ryYe4ofWNc7+bOqgJjH4hILs2P1gLjdha7C7V4pAznVjmvDdNSrvZ4YbAMVzn0 gSN/IoPfN+LHRvAfP0ihsViOSvRt1cSoITxcv+uoNiVmOCCNQt24XriNMKTvcF6DtOGc IsGl5ua/K853BK44BbmYRGdo5Rl/5MeR1xYKdQXYaIwMYkWv2iLbUVQcplWaIQ3osbzM q6sQ== X-Gm-Message-State: AOAM5312ovT8bZe5zeq/E5k80Ndl9XLU5U1cUbeqqWonA04XJpSCILZL QTeRqXBqEBXrrbnUojz2z3LCFvbuTAY= X-Received: by 2002:a9d:527:: with SMTP id 36mr2890059otw.363.1631104953315; Wed, 08 Sep 2021 05:42:33 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id l4sm414519oth.4.2021.09.08.05.42.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 08 Sep 2021 05:42:32 -0700 (PDT) Sender: Guenter Roeck To: Arnd Bergmann , Geert Uytterhoeven Cc: Al Viro , Linus Torvalds , "David S. Miller" , Dmitry Torokhov , Christian Koenig , Huang Rui , Linux Kernel Mailing List , linux-sparc , Martin Sebor References: <20210906142615.GA1917503@roeck-us.net> <20210906234921.GA1394069@roeck-us.net> <20210908042838.GA2585993@roeck-us.net> From: Guenter Roeck Subject: Re: [PATCH] Enable '-Werror' by default for all kernel builds Message-ID: <23b3a9ab-7205-9f4e-9425-17506aec3170@roeck-us.net> Date: Wed, 8 Sep 2021 05:42:30 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/8/21 2:50 AM, Arnd Bergmann wrote: > On Wed, Sep 8, 2021 at 9:49 AM Geert Uytterhoeven wrote: >> On Wed, Sep 8, 2021 at 7:16 AM Guenter Roeck wrote: >>> On 9/7/21 9:48 PM, Al Viro wrote: >>>> On Tue, Sep 07, 2021 at 09:28:38PM -0700, Guenter Roeck wrote: >>>>> memcpy(eth_addr, sanitize_address((void *) 0xfffc1f2c), ETH_ALEN); >>>>> >>>>> but that just seems weird. Is there a better solution ? >>>> >>>> (char (*)[ETH_ALEN])? Said that, shouldn't that be doing something like >>>> ioremap(), rather than casting explicit constants? >>> >>> Typecasts or even assigning the address to a variable does not help. >>> The sanitizer function can not be static either. >> >> So it can only be fixed by obfuscating the constant address in a >> chain of out-of-line functions... >> How is this compiler to be used for bare-metal programming? > > I reported this as a gcc bug when I first saw it back in March: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578 > > Martin Sebor suggested marking the pointer as 'volatile' as a workaround, > which is probably fine for bare-metal programming, but I would consider > that bad style for the kernel boot arguments. The RELOC_HIDE trick is probably > fine here, as there are only a couple of instances, and for the network > driver, using volatile is probably appropriate as well. > > I still hope this can be fixed in a future gcc-11.x release. Maybe we should > add further instances of the problem on the gcc bug to boost the priority? > >>> I don't know the hardware, so I can not answer the ioremap() question. >> >> Yes it should. But this driver dates back to 2.1.110, when only >> half of the architectures already had ioremap(). > > How does mvme16x even create the mapping? Is this a virtual address > that is hardwired to the bus or do you have a static mapping somewhere? > I see two other drivers accessing the nvram here > > arch/m68k/mvme16x/config.c:static MK48T08ptr_t volatile rtc = > (MK48T08ptr_t)MVME_RTC_BASE; Is that even correct ? I am always shaky with qualifiers, but doesn't that mean that the pointer is volatile, not the object it points to ? > arch/m68k/mvme16x/rtc.c: volatile MK48T08ptr_t rtc = > (MK48T08ptr_t)MVME_RTC_BASE; > > The same trick should work here, just create a local variable with a > volatile pointer and read from that. > I had tried that; it doesn't work because then the compiler complains that the 'volatile' qualifier is discarded when passing the argument. drivers/net/ethernet/i825xx/82596.c: In function 'i82596_probe': drivers/net/ethernet/i825xx/82596.c:1147:34: error: passing argument 2 of '__builtin_memcpy' discards 'volatile' qualifier from pointer target type Oddly enough, a memcpy on the 'rtc' variable doesn't fail, neither with nor without volatile. Something else is going on. Guenter