[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240801152253.GA122261@thelio-3990X>
Date: Thu, 1 Aug 2024 08:22:53 -0700
From: Nathan Chancellor <nathan@...nel.org>
To: Christoph Hellwig <hch@....de>
Cc: kernel test robot <lkp@...el.com>, Baruch Siach <baruch@...s.co.il>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>, llvm@...ts.linux.dev,
oe-kbuild-all@...ts.linux.dev, linux-s390@...r.kernel.org,
Ramon Fried <ramon@...reality.ai>,
Petr Tesařík <petr@...arici.cz>,
Robin Murphy <robin.murphy@....com>, linux-kernel@...r.kernel.org,
iommu@...ts.linux.dev, Elad Nachman <enachman@...vell.com>,
linuxppc-dev@...ts.ozlabs.org, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v3 2/3] dma-mapping: replace zone_dma_bits by
zone_dma_limit
On Thu, Aug 01, 2024 at 03:44:54PM +0200, Christoph Hellwig wrote:
> On Wed, Jul 31, 2024 at 06:24:24PM -0700, Nathan Chancellor wrote:
> > Unfortunately, I am not sure either... I do not see anything obviously,
> > so perhaps it could just be avoided with the __diag() infrastructure?
> >
> > diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c
> > index 3dbc0b89d6fb..b58e7eb9c8f1 100644
> > --- a/kernel/dma/direct.c
> > +++ b/kernel/dma/direct.c
> > @@ -20,7 +20,12 @@
> > * it for entirely different regions. In that case the arch code needs to
> > * override the variable below for dma-direct to work properly.
> > */
> > +__diag_push();
> > +__diag_ignore(clang, 13, "-Wconstant-conversion",
> > + "Clang incorrectly thinks the n == 64 case in DMA_BIT_MASK() can happen here,"
> > + "which would truncate with a 32-bit phys_addr_t");
> > phys_addr_t zone_dma_limit __ro_after_init = DMA_BIT_MASK(24);
>
> So.. The code above is clearly wrong, as DMA_BIT_MASK always returns a
> u64, and phys_addr_t can be smaller than that. So at least in this case
> the warning seems perfectly valid and the code has issues because it is
> mixing different concepts.
Sure, that seems like a reasonable way to look at things even if the
warning itself is a false positive.
> Where do you see warnings like this upstream?
I don't see this upstream, this is from patch 2 of this series:
https://lore.kernel.org/053fa4806a2c63efcde80caca473a8b670a2701c.1722249878.git.baruch@tkos.co.il/
Cheers,
Nathan
Powered by blists - more mailing lists