Re: [PATCH 27/67] dma-direct: add dma address sanity checks

From
Christoph Hellwig <hch@lst.de>
Date
2018-01-04 08:52:11
Also in
linux-alpha, linux-arch, linux-arm-kernel, linux-iommu, linux-m68k, linux-mips, linux-s390, linux-sh, lkml, sparclinux
Reply to
Geert Uytterhoeven, 2017-12-29
On Fri, Dec 29, 2017 at 03:12:25PM +0100, Geert Uytterhoeven wrote:
quoted
+check_addr(struct device *dev, dma_addr_t dma_addr, size_t size,
+               const char *caller)
+{
+       if (unlikely(dev && !dma_capable(dev, dma_addr, size))) {
+               if (*dev->dma_mask >= DMA_BIT_MASK(32)) {
+                       dev_err(dev,
+                               "%s: overflow %llx+%zu of device mask %llx\n",
Please use "%pad" to format dma_addr_t ...
quoted
+                               caller, (long long)dma_addr, size,
... and use &dma_addr.
quoted
+                               (long long)*dev->dma_mask);
This cast is not needed, as u64 is unsigned long long in kernelspace on
all architectures.
Thanks, fixed.
Thread (97 messages) 97 messages, 8 authors, last reply 2018-01-09
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help