Re: [PATCH v2 01/21] dma-mapping: Allow map_sg() ops to return negative error codes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Logan Gunthorpe <logang@xxxxxxxxxxxx>
- Subject: Re: [PATCH v2 01/21] dma-mapping: Allow map_sg() ops to return negative error codes
- From: Christoph Hellwig <hch@xxxxxx>
- Date: Sun, 25 Jul 2021 08:07:47 +0200
- Cc: linux-kernel@xxxxxxxxxxxxxxx, linux-alpha@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx, linux-mips@xxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, linux-s390@xxxxxxxxxxxxxxx, sparclinux@xxxxxxxxxxxxxxx, iommu@xxxxxxxxxxxxxxxxxxxxxxxxxx, linux-parisc@xxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, Christoph Hellwig <hch@xxxxxx>, Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>, Robin Murphy <robin.murphy@xxxxxxx>, Stephen Bates <sbates@xxxxxxxxxxxx>, Martin Oliveira <martin.oliveira@xxxxxxxxxxxxx>
- In-reply-to: <20210723175008.22410-2-logang@deltatee.com>
- References: <20210723175008.22410-1-logang@deltatee.com> <20210723175008.22410-2-logang@deltatee.com>
- User-agent: Mutt/1.5.17 (2007-11-01)
> +int dma_map_sgtable(struct device *dev, struct sg_table *sgt,
> + enum dma_data_direction dir, unsigned long attrs)
> +{
> + int nents;
> +
> + nents = __dma_map_sg_attrs(dev, sgt->sgl, sgt->orig_nents, dir, attrs);
> + if (nents == 0)
> + return -EIO;
> + else if (nents < 0) {
> + if (WARN_ON_ONCE(nents != -EINVAL && nents != -ENOMEM &&
> + nents != -EIO))
> + return -EIO;
I think this validation of the errnos needs to go into __dma_map_sg_attrs,
so that we catch it for the classic dma_map_sg callers as well.
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]