Thread (25 messages) 25 messages, 4 authors, 2021-08-02

Re: [PATCH v2 01/21] dma-mapping: Allow map_sg() ops to return negative error codes

From: Christoph Hellwig <hch@lst.de>
Date: 2021-07-25 06:07:54
Also in: linux-alpha, linux-iommu, linux-mips, linux-s390, linuxppc-dev, lkml, sparclinux, xen-devel

+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.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help