Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1985511lqp; Tue, 16 Apr 2024 04:10:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW5ocByWtT/TEY1nRvTqQWlf/bbIjJ0Uo2uaop3T+JNK8MC6/Zi0uHnzut0qPO0dlQe9rRbjq/1Aq6laQ7HF9K1OuwRKcgh4wikVbHrAQ== X-Google-Smtp-Source: AGHT+IHod4Os5iJaZpvCpxjdr6FwV/ZA28fgXVBiLbAbgSdRbfRpunRXgWOP3SAHDpM+4WK8I+vl X-Received: by 2002:a05:6a20:1206:b0:1a7:4e61:ebc9 with SMTP id v6-20020a056a20120600b001a74e61ebc9mr10998066pzf.62.1713265811540; Tue, 16 Apr 2024 04:10:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713265811; cv=pass; d=google.com; s=arc-20160816; b=v7fkpCqRzYXJFrIWGzN6n4BTnXprNh6Vf1Ar0yK0q91smpX1qX5DDgiDqEGHkcvtcB ZhUYkd4IvsHDLlw+NtSUG6ujKRYdfHN3o8rchPsLo1res6T+1PGVJ6hLENsKeZcUronN +rpVS5i/6GgVfFkK5vk8qvEmMLfBLofopnwzeoRKVCzR3lpYqIh8/0onofP13cHacOBs w1Rvt5x7pwOKh2E+uMB9Wt2wab1LHsX2I/YongET1I8oTeaia6/TZc/In6gl+snsOqFR MWmXzQmMA33vPLrAGfOw6e639bW2WBpL69QMsZkv2WoIXpLwEf9Etiw1AimAFGvn4nU4 Uw/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:accept-language :in-reply-to:references:message-id:date:thread-index:thread-topic :subject:cc:to:from; bh=bJKCanDb6PnuUgOuhYZyckkxLWdT8RwSv5Eo69f6L9o=; fh=2gZCByJs71xtt7eHn6cF31vnoqMq8VLX3m0wBd6c8Tg=; b=iciYzGbd+kFgRsaYE5D8Zq4RTfrEQziPTMqyBZX3L8kb63Zy7Hye7BY8rFtL86PcbC IFF9Fj/jdRlF64PZ2iUZDVfEmleGy8Y8WJHGjB0zX+c05ItGzJYkT+D+/VPGNd1ieikj 64MYxMrqFWkUswf+Sx/+Me94Zr5c+aLF3BvzX1QqjL3aCvyht40tuMqjx9U2+7YpsWi6 Cgkt33NY4aqpfHK5PNCBNLbnZKDVUP/M1WZi+/bdvfKtc2vqoOltU+/BQT3gHDf8gwVM JKIMupR8qu+FrNBT2RfFrmtdH9lDDKv4jPpmFH5wP827N4FUf2tKMfg1MVk9MsKGwN3e r15A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=aculab.com dmarc=pass fromdomain=aculab.com); spf=pass (google.com: domain of linux-kernel+bounces-146689-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146689-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id u2-20020a056a00124200b006ecf8c86c92si9473537pfi.168.2024.04.16.04.10.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 04:10:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-146689-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=aculab.com dmarc=pass fromdomain=aculab.com); spf=pass (google.com: domain of linux-kernel+bounces-146689-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146689-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id EBC372820F8 for ; Tue, 16 Apr 2024 11:10:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DA2FB128808; Tue, 16 Apr 2024 11:10:05 +0000 (UTC) Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.86.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D746F128384 for ; Tue, 16 Apr 2024 11:10:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.58.86.151 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713265805; cv=none; b=DxbsJm8/R5z0R7tS+c+iNfwQD8BqAysu4BD4Zn7CxB7h1GMorcpP6E4pqB7GRF0CSN2yRs/vm9B4JHfAizQPmP1ipx5n2VY/BUWQJDdpTr8CGwetx7OgdKFV3Hw2uolq6oPJF1yN8NWPNBvVT4GjmUp820Qo2JpNBI5W+xPNgNI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713265805; c=relaxed/simple; bh=DGnXGWBZ6/NHWbsu+aI1H9Su1DSjbVK/pq0pcF7oTHQ=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: MIME-Version:Content-Type; b=kL/O+iE3MelfZCUVaN9DWwgxneOSNNHRbdmokOZaefjAgIpue2c8OQQz1WFJVT5YVhSOQy1Vp1iPpXvJ7scEY4LLxJXzORjsEvCiPjTYKrtdy7ZAg6vgROifRNKVaq+elQyg+sgOY1A9ilVhooB2nHVXCYLZH7naD1OIM9Z3tEM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ACULAB.COM; spf=pass smtp.mailfrom=aculab.com; arc=none smtp.client-ip=185.58.86.151 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ACULAB.COM Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aculab.com Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-255-LPfE2IzbO0utuOqpskCb8A-1; Tue, 16 Apr 2024 12:09:55 +0100 X-MC-Unique: LPfE2IzbO0utuOqpskCb8A-1 Received: from AcuMS.Aculab.com (10.202.163.4) by AcuMS.aculab.com (10.202.163.4) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 16 Apr 2024 12:09:27 +0100 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Tue, 16 Apr 2024 12:09:27 +0100 From: David Laight To: 'Segher Boessenkool' , Naresh Kamboju CC: Nathan Chancellor , Anders Roxell , Linux Regressions , Arnd Bergmann , clang-built-linux , "Nick Desaulniers" , open list , "lkft-triage@lists.linaro.org" , Aneesh Kumar K.V , Jeff Xu , "Naveen N. Rao" , linuxppc-dev , Dan Carpenter , Kees Cook Subject: RE: powerpc: io-defs.h:43:1: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic] Thread-Topic: powerpc: io-defs.h:43:1: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic] Thread-Index: AQHaj+s965G0tAMqzUOctdh7rJqb8rFqvAFg Date: Tue, 16 Apr 2024 11:09:26 +0000 Message-ID: <1d0de2bee67643bfa5a561e70133db75@AcuMS.aculab.com> References: <20240416103819.GQ19790@gate.crashing.org> In-Reply-To: <20240416103819.GQ19790@gate.crashing.org> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable From: Segher Boessenkool > Sent: 16 April 2024 11:38 >=20 > On Tue, Apr 16, 2024 at 03:02:52PM +0530, Naresh Kamboju wrote: > > In file included from arch/powerpc/include/asm/io.h:672: > > arch/powerpc/include/asm/io-defs.h:43:1: error: performing pointer > > arithmetic on a null pointer has undefined behavior > > [-Werror,-Wnull-pointer-arithmetic] >=20 > It is not UB, but just undefined: the program is meaningless. >=20 > It is not a null pointer but even a null pointer constant here. It > matters in places, including here. >=20 > It would help if the warnings were more correct :-( Isn't it only a problem because the NULL pointer isn't required to be the all-zero bit pattern? So when do we get a warning from using memset() on a structure that contains pointers? Since it is equally buggy. Has anyone ever seen a system where NULL wasn't 'all zeros'? I've used a system where the 'native' invalid pointer was 'all ones', but even there the C code used 'all zeros'. =09David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1= PT, UK Registration No: 1397386 (Wales)