[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190722114303.GA32052@lst.de>
Date: Mon, 22 Jul 2019 13:43:03 +0200
From: Christoph Hellwig <hch@....de>
To: Eric Auger <eric.auger@...hat.com>
Cc: eric.auger.pro@...il.com, hch@....de, m.szyprowski@...sung.com,
robin.murphy@....com, iommu@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] dma-mapping: Protect dma_addressing_limited against
NULL dma_mask
I posted a fix that takes care of this in SCSI this morning:
https://marc.info/?l=linux-scsi&m=156378725427719&w=2
I suspect for virtio-blk we should do the same.
> static inline bool dma_addressing_limited(struct device *dev)
> {
> - return min_not_zero(*dev->dma_mask, dev->bus_dma_mask) <
> - dma_get_required_mask(dev);
> + return dev->dma_mask ? min_not_zero(*dev->dma_mask, dev->bus_dma_mask) <
> + dma_get_required_mask(dev) : false;
But to be on the safe side we could still do an early return here,
but it should have a WARN_ON_ONCE.
Powered by blists - more mailing lists