Received: by 2002:a05:7412:4e10:b0:e2:908c:2ebd with SMTP id gb16csp14808rdb; Mon, 6 Nov 2023 21:58:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IFYLfid0O4UE1PayNIOyqNKfLkjFxGzSDGmLH3dEgC48C81X0GglDCi3TyQ4CvNo6u9kOkH X-Received: by 2002:a05:6300:8088:b0:17f:fef8:1f3f with SMTP id ap8-20020a056300808800b0017ffef81f3fmr32183833pzc.4.1699336694374; Mon, 06 Nov 2023 21:58:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699336694; cv=none; d=google.com; s=arc-20160816; b=cpnFdr1sobEIa7Ky+REGH/roNg1CDAkSN6HZnF76o8em2/u61C83Fcm/tt2LE156i7 z80D/MHk7MbU/vUpGHA1vvmG/oFdmrfWIJ6o9zr36SDtNwq/WBCPiE/mr3PCXIH5gxvu v0EMiU2b7HRoqdq6hD8/PYtMrBq7ADUjGGxaEGYgvh5+X+3e2N9l+4dzbFYisDf/NrgU S2r/D9RYjDBg99VTy9N7jaPBa9d8wQZJmrME/WRO28Z1/xNbyHYMsv1TtVRObQYFMT0i IRq9cgibeQlcKhFOMzinY0eP/+/Zk7lcZnV9JZi2cLn+3txB7jyXW263zZ+S1w0YC4R1 gcdQ== 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:references:in-reply-to:subject:cc:to:from :dkim-signature; bh=WLSmH2YPB6ObGHIHtgDYQTqiAIGZxZwcz5obGeCszlA=; fh=TOzMXJuMUlPgvYeOt8Umw3UVsBGSoTxmU/XfKl20uoI=; b=wyPOGBuTY/SK/33OO3fhOiC0091Zbv+DPoZ7cszewA1q87poKaPPtu4krEVd0veY24 86iZD/ekAPf957Y9RhlSugqEFVOYA16VJeUy3JutWFaVOhLjIvDoHjoamk8zsr9J9JHl 3RtxiOlHKZoge4tzYM/FWENIoPBR99c1VosfZv8u5X6haLYq3Wz69GgrXWvnn1U9FG7Z SxOIxT7SeBvDjWV5xS6mUo3IRy47DvLx7rGHXLRBgi7ykYq43Yd/n6fHQo/jbvTlYMCo cZ4GgqtKyvmTcCKYz6Pzx7KziydRxinfYWlXLRMIFObkP/4Q0VEH3vTTlC5R2T7A/T3I +mBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=Phtdf1Fh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id fa36-20020a056a002d2400b006c128a7f813si10296143pfb.177.2023.11.06.21.58.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 21:58:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=Phtdf1Fh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id EB0EC802390B; Mon, 6 Nov 2023 21:58:11 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230089AbjKGF5t (ORCPT + 99 others); Tue, 7 Nov 2023 00:57:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229558AbjKGF5s (ORCPT ); Tue, 7 Nov 2023 00:57:48 -0500 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65189DF for ; Mon, 6 Nov 2023 21:57:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1699336664; bh=WLSmH2YPB6ObGHIHtgDYQTqiAIGZxZwcz5obGeCszlA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Phtdf1Fhfq/erjjW2irSLi9DfgpGK3jtR86PifRopkpQ7EorydzfZltVCcBlW+oNr 4tlI4jOopCn9HgMgvZ/AFrRpHLQ8l3KSZwzYlq+rD70c8btUhG8k9qNbLDcfCkuXlh dTeGNoM/yBJWPmBqXJ5z9kkiHgyxEQkn7INidyhIt4i/jXSDpJVhc7Hi8eKEnwCjF4 VnyS+Xf1E0IFSOqVSyXozXRMIjmMGQwGM1XVfLpgihoQ9YjlVe02p+3T0qmJ+RlP84 j2sc5y7RhEO95k4iGNaISatDNllYL42OHEKZkP9d/GUm1T8i45x5e7LjP12eUdIws/ hRAO81FEAEpCA== Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4SPcvC5Yfbz4x7q; Tue, 7 Nov 2023 16:57:43 +1100 (AEDT) From: Michael Ellerman To: Linus Walleij , Nicholas Piggin , Christophe Leroy Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, kernel test robot , Linus Walleij Subject: Re: [PATCH] powerpc: Fix signature of pfn_to_kaddr() In-Reply-To: <20231106-virt-to-pfn-fix-ppc-v1-1-93197a7ccab4@linaro.org> References: <20231106-virt-to-pfn-fix-ppc-v1-1-93197a7ccab4@linaro.org> Date: Tue, 07 Nov 2023 16:57:40 +1100 Message-ID: <87ttpyw1ez.fsf@mail.lhotse> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 06 Nov 2023 21:58:12 -0800 (PST) Linus Walleij writes: > There is a const in the returned value from pfn_to_kaddr() > but there are consumers that want to modify the result > and the generic function pfn_to_virt() in > does allow this, so let's relax this requirement and do not > make the returned value const. > > Reported-by: kernel test robot > Closes: https://lore.kernel.org/oe-kbuild-all/202311061940.4pBrm44u-lkp@i= ntel.com/ =20 I'm struggling to connect the removal of const with those bug reports. It looks like all those warnings are about 0xc000000000000000 being outside the range of unsigned long when building 32-bit. Is it the right bug report link? The current signature of: static inline const void *pfn_to_kaddr(unsigned long pfn) ... seems OK to me. It allows code like: const void *p =3D pfn_to_kaddr(pfn); p++; But errors for: const void *p =3D pfn_to_kaddr(pfn); unsigned long *q =3D p; *q =3D 0; error: initialization discards =E2=80=98const=E2=80=99 qualifier from poi= nter target type Having said that it looks like almost every caller of pfn_to_kaddr() casts the result to unsigned long, so possibly that would be the better return type in terms of the actual usage. Although that would conflict with __va() which returns void * :/ cheers