Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp1108618lqb; Wed, 17 Apr 2024 23:33:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWjvU4IyUKAutvuvrhDkjPLcyMvIXqu0owr9iFuFHdPQNRXxaNJyiJ6X2jwZGsnmVeq5v80EZBPBjBj3R6nHlTgggDLdazyrAq2imwBWQ== X-Google-Smtp-Source: AGHT+IH9riwXJmf00q5IBONsnIz8gzycoOBdHgoUONtbIkx3AXKLmL61U37JzjMDSrVjwuH4jPSq X-Received: by 2002:a17:902:ce91:b0:1e0:ab65:85e5 with SMTP id f17-20020a170902ce9100b001e0ab6585e5mr2376735plg.1.1713421994524; Wed, 17 Apr 2024 23:33:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713421994; cv=pass; d=google.com; s=arc-20160816; b=qhUjHyTc+7cLCa9EmZPRtsJFB80ls4C+pBDoeFdnHjakiSfwdJzj/J4gF+k3+JLln9 ijaybJriCgRE7AyorEPHf8BVqA/hd4OdvEpsYcgjTb+TUBxKZF/qM+YUeJjVxneslyw9 AWEwgguFn4+KeqkC+oLD8unvgQfHumxXvEIaAULzev/R25HBRDG8QVYkFa4CP/uQddJo BS6Ow+RNp5q1hSoJvfUwMSKrI8FuYYlU2zFL538WN5vfyusuEhwE/AtFk7JgGNAhJOwD 1EsTMYzbebBAGQVTn3S5twb07b1XS8Emr2TXFcDlZN0Dm5LYDaa81+zAFGJhoWc+MHGZ gy0Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:in-reply-to:subject:cc:to:from :dkim-signature; bh=Os3n75joztuZwb7Uo98ZK8zUHbtnDL2bSCbwHpOcZE4=; fh=XrJKYqO/Pn1OHnSGVovQVHyaNO8Vj8YZCDVSXqfsGpU=; b=ih2XplayZD3V+iA3Hart1naw7teyqqT89iLGOWVoJBRVp2dTdkZCZ9hsMCYLv6l/rG gTOzXowsptUhYRDG0Ps2oo2YyvQmCeOzuDAgSl5ow9IbJ34wU9LnhDofPLEv+ecEgejF bN7DLtNLLXuTkjBROZ1u6y79m/oTLd1phS6ap944NMxyNU79WWkFb2cp3XndG0sdjO8S agw+UVSVL3j7pKksz3TBpsDrj8PW7sXmJIUUt1F4aTtK4sPcNcnGCLgqmA1B3bPG7DTe 2EVN32DgIlIRd+l1YfonwLrMMe1BQWpSp7wPJ1esaboYYXZIfggoX6UW1cGNh0yInJmz FQJQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=UpYxncQ7; arc=pass (i=1 spf=pass spfdomain=ellerman.id.au dkim=pass dkdomain=ellerman.id.au); spf=pass (google.com: domain of linux-kernel+bounces-149585-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149585-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id mf14-20020a170902fc8e00b001e0d630f345si847966plb.645.2024.04.17.23.33.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 23:33:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-149585-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=UpYxncQ7; arc=pass (i=1 spf=pass spfdomain=ellerman.id.au dkim=pass dkdomain=ellerman.id.au); spf=pass (google.com: domain of linux-kernel+bounces-149585-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149585-linux.lists.archive=gmail.com@vger.kernel.org" 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 26BC0281DBE for ; Thu, 18 Apr 2024 06:33:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A7CB3225D9; Thu, 18 Apr 2024 06:33:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ellerman.id.au header.i=@ellerman.id.au header.b="UpYxncQ7" Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (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 1772923DE for ; Thu, 18 Apr 2024 06:33:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=150.107.74.76 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713421987; cv=none; b=C8zjiSCYMsbiQ48zHqHCl+dT4JK3YKwbFlIMP/ZcBEsbKWw0V9mj2UiqlzhhpbSIEUqoZQ3jOFqi5z0+ZKFJmYTGjUBWHFt9Lw74g07kvh4baGY7Zz2rLPkgOIActDcRthG6B85xyOWX3rr6HlmK2209JHJiI8QLX4HvDufF4Dk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713421987; c=relaxed/simple; bh=pQMBecgqfKdbPKjdn4yS3sDc77mBnocF1E8KpVGeTVo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=OvSdwn2WrnFXqVW1m3TWiBEfY0MoArUuGnsTt0OvHN0JpGT8/mLl7TLQYks/Z3uvkvg60JZOS9G6H+1EtdChWh7VCF6P6GhWwLIX3EbxwE0vJS6wTDWQUzb86u6dSxF0vYdy5zodvx7xL3a7/sEnifmYbja5xh/OoBXsiIReLBU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au; spf=pass smtp.mailfrom=ellerman.id.au; dkim=pass (2048-bit key) header.d=ellerman.id.au header.i=@ellerman.id.au header.b=UpYxncQ7; arc=none smtp.client-ip=150.107.74.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ellerman.id.au DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1713421984; bh=Os3n75joztuZwb7Uo98ZK8zUHbtnDL2bSCbwHpOcZE4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=UpYxncQ7XHP+jss1hZdkT5vMaxWi3UsZZtID/xtfljbj+dZWc2jBahOY2aXHfD8y/ RVsJRnN7oRlQ51KLRItu4vVMzvHZuDSBlkXS2vaa0kLCo0FNzJDORHCGtohKi/qiq2 O6Y3sB4pjJIKSL+WOdB+MPmuObWgwilq8rQFQIwrB1sqNBG7wj0xvmApVHx7J6xxz2 MfSgJr2XjXJrJ9ZSMOm6Ti10tkZS3ejgm15X9sf+rIjEWWXpUVJ0XmA/4yCUKnhR9/ 6oxerVLHbTcaMiW2Qnfget/zDJ5DS+tRK6pFBaW6lVpH9PuNyfFHDPRPhH6lHPR6ra 6I3EG15SaNS2g== 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 4VKnym2YSCz4wcR; Thu, 18 Apr 2024 16:33:04 +1000 (AEST) From: Michael Ellerman To: Arnd Bergmann Cc: Arnd Bergmann , Naresh Kamboju , linux-kernel@vger.kernel.org, linuxppc-dev , "Aneesh Kumar K . V" , Anders Roxell , Kees Cook , Niklas Schnelle , clang-built-linux , Nick Desaulniers , Nathan Chancellor , Jeff Xu , "Naveen N . Rao" , Dan Carpenter , Nicholas Piggin , Christophe Leroy , Bill Wendling , Justin Stitt , Baoquan He , "Mike Rapoport (IBM)" Subject: Re: [PATCH] powerpc: drop port I/O helpers for CONFIG_HAS_IOPORT=n In-Reply-To: <878r1bb2zj.fsf@mail.lhotse> References: <20240416153331.1617772-1-arnd@kernel.org> <878r1bb2zj.fsf@mail.lhotse> Date: Thu, 18 Apr 2024 16:33:04 +1000 Message-ID: <875xwfb2ov.fsf@mail.lhotse> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Michael Ellerman writes: > Arnd Bergmann writes: >> From: Arnd Bergmann >> >> Calling inb()/outb() on powerpc when CONFIG_PCI is disabled causes >> a NULL pointer dereference, which is bad for a number of reasons. >> >> After my patch to turn on -Werror in linux-next, this caused a >> compiler-time warning with clang: >> >> 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] >> 43 | DEF_PCI_AC_NORET(insb, (unsigned long p, void *b, unsigned long c), >> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> 44 | (p, b, c), pio, p) >> | ~~~~~~~~~~~~~~~~~~ >> >> In this configuration, CONFIG_HAS_IOPORT is already disabled, and all >> drivers that use inb()/outb() should now depend on that (some patches are >> still in the process of getting marged). >> >> Hide all references to inb()/outb() in the powerpc code and the definitions >> when HAS_IOPORT is disabled to remove the possible NULL pointer access. >> The same should happin in asm-generic in the near future, but for now >> the empty inb() macros are still defined to ensure the generic version >> does not get pulled in. >> >> Signed-off-by: Arnd Bergmann >> Reported-by: Naresh Kamboju >> -- > > This needs a small fixup: Well, only because my tree doesn't have f0a816fb12da ("/dev/port: don't compile file operations without CONFIG_DEVPORT"). cheers