Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2398542pxj; Mon, 10 May 2021 01:50:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyu6c2Twr7wB/wDiFmosJO3rfECgolYog84tsrvRLKNNoHrY30/V3vgESpi+c5l6U/ROnm X-Received: by 2002:a05:6e02:1ba3:: with SMTP id n3mr14053745ili.20.1620636628975; Mon, 10 May 2021 01:50:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620636628; cv=none; d=google.com; s=arc-20160816; b=ne01lGL3fl4ERby0vmKtgKg2RqMmWWaR7j//ZomtGG+unvsnAjG+ya4sHrVaSNbsxa j/m2GzTgWiy11OIWnsJrpIMsOJRJOAJu0CPuRxrfdkMvYRIbWhDI8dYuZpUpfPC0YUM2 /g5xplTGeOiP+T0AkZamk2UDXaIlcQhkifaa9K3spi32AD7R4yz+hCDxL0r7gVEiC3h3 mpUEoOA/iRIhjodAw9DapTsiOhhiSyxgdxyv0QneiIYkHo8s0Wpy2FeE1k7YkuXcQX9w 8hJvML6Srmv4bwM6JnHvOnuThPofsJvAdRqXCbjMnlVQpm+QZCTaTb9sZWBfqfHSwnqO ofdQ== 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:dkim-signature; bh=4yO9eZxepSCyEp/8vUMaotEbypsOwfQJcgLtkm5jAsc=; b=zCWcNLuthSFgmtQfL1Kyhw5bzeBap0Kv6fIxOwVYc5hWsLODI/DexkQ5KunDSXVLuc YYZLkMzVt8E4QROyaE9eah4Q+dz9IzHrdjiPPppTTOVcwbUc35hSLsBfTCV9b+XH3YHw pxfd4TNatbFv5RU55ZNacZU3WD1LNBHsHMNkAa1vYFuoX2vwyIiovHFL1Kwds6ZheizV KknNjjVuCXFNnMS3YTMFqkHovQUciFhywHuO9Z/7VgnGYX/vsYg/Utl9eboJvRkVhdSO cjx3BqWBgkihzgQPoZgG2t2cOAkQ2Xbf0BbDZIznxweXLLm2z4mwfkuR5zWsvD1E9Ccz 4DWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=jHXUB2Yd; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l15si10830530jaj.81.2021.05.10.01.50.15; Mon, 10 May 2021 01:50: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; dkim=pass header.i=@ibm.com header.s=pp1 header.b=jHXUB2Yd; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230160AbhEJIuq (ORCPT + 99 others); Mon, 10 May 2021 04:50:46 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:57702 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230209AbhEJItG (ORCPT ); Mon, 10 May 2021 04:49:06 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 14A8WxRR054354; Mon, 10 May 2021 04:47:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=4yO9eZxepSCyEp/8vUMaotEbypsOwfQJcgLtkm5jAsc=; b=jHXUB2YdvHj0jFuMK0dYYMcS7BPELF5KdCSsik4VjAXfnKrzPsi71IQaYAwJqZ4fTaQC Vdc1Uw8f00e/Px2Rk6sLR6siGJSe85K78bTFvYE3PD+UW1MBCx6gDgOH6F+r+ntwUYjA J23XHeOHCjx88bOahURrA7gBER7c2MDbXAWZr6TzPQ67m2kTR6nom3WqW4xmS7WdKlIj Zd9QVQf0Vcp7onAW0OC15efZhaizFFjy1nVRQiD6S9fxrNHFRChVa+IvxlpW+M+epf6z qiEjBNoGVpS9pWbSDdrh+ZNzNCPGGuMc4y0gXug6fBkf4tSIRAJkFEluff7mvsMtzT4J nQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 38exgcnd2r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 May 2021 04:47:49 -0400 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 14A8X9wj054828; Mon, 10 May 2021 04:47:49 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 38exgcnd20-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 May 2021 04:47:48 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 14A8gf3i023607; Mon, 10 May 2021 08:47:46 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma03ams.nl.ibm.com with ESMTP id 38dj988sfy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 May 2021 08:47:46 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 14A8lisr21037452 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 10 May 2021 08:47:44 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 44B054C052; Mon, 10 May 2021 08:47:44 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D55F44C059; Mon, 10 May 2021 08:47:43 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 10 May 2021 08:47:43 +0000 (GMT) From: Niklas Schnelle To: Arnd Bergmann , Vineet Gupta , "David S. Miller" Cc: Nathan Chancellor , Nick Desaulniers , clang-built-linux@googlegroups.com, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-snps-arc@lists.infradead.org, sparclinux@vger.kernel.org Subject: [PATCH 0/3] asm-generic/io.h: Silence -Wnull-pointer-arithmetic warning on PCI_IOBASE Date: Mon, 10 May 2021 10:47:40 +0200 Message-Id: <20210510084743.1850777-1-schnelle@linux.ibm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: NMdOodGgcMvFTQlivDvIFZED_HKrqbO3 X-Proofpoint-GUID: iRZs0VnKc3G77quBi8FWVfDuKQ_XxELi X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-05-10_02:2021-05-10,2021-05-10 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 impostorscore=0 clxscore=1015 spamscore=0 mlxlogscore=670 bulkscore=0 suspectscore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105100061 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, This is version 5 of my attempt to get rid of a clang -Wnull-pointer-arithmetic warning for the use of PCI_IOBASE in asm-generic/io.h. This was originally found on s390 but should apply to all platforms leaving PCI_IOBASE undefined while making use of the inb() and friends helpers from asm-generic/io.h. This applies cleanly and was compile tested on top of v5.12 for the previously broken ARC, nds32, h8300 and risc-v architecture. It also applies cleanly on v5.13-rc1 for which I boot tested it on s390. I did boot test this only on x86_64 and s390x the former implements inb() itself while the latter would emit a WARN_ONCE() but no drivers use inb(). Thanks, Niklas Changes since v4: - Added Link to patch 4 (Arnd) - Improved comment on RISC-V patch mentioning current brokeness (Arnd) Changes since v3: - Changed the subject of the last patch to better reflect the actual change i.e. the addition of WARN_ONCE() to the helpers not the silencing of the clang warning - Added asm/bug.h to asm-generic/io.h so it doesn't have to be included previously by all arches to be available for the WARN_ONCE() - Added patch for risc-v which defines PCI_IOBASE except when compiled for nommu Changes since v2: - Improved comment for SPARC PCI_IOBASE definition as suggested by David Laight - Added a patch for ARC which is missing the asm/bug.h include for WARN_ONCE() (kernel test robot) - Added ifdefs to ioport_map() and __pci_ioport_map() since apparently at least test configs enable CONFIG_HAS_IOPORT_MAP even on architectures which leave PCI_IOBASE unset (kernel test robot for nds32 and ARC). Changes since v1: - Added patch to explicitly set PCI_IOBASE to 0 on sparc as suggested by Arnd Bergmann - Instead of working around the warning with a uintptr_t PCI_IOBASE make inb() and friends explicitly WARN_ONCE() and return 0xff... (Arnd Bergmann) Niklas Schnelle (3): sparc: explicitly set PCI_IOBASE to 0 risc-v: Use generic io.h helpers for nommu asm-generic/io.h: warn in inb() and friends with undefined PCI_IOBASE arch/riscv/include/asm/io.h | 5 +-- arch/sparc/include/asm/io.h | 8 +++++ include/asm-generic/io.h | 65 ++++++++++++++++++++++++++++++++++--- 3 files changed, 72 insertions(+), 6 deletions(-) -- 2.25.1