To: | Christoph Hellwig <hch@lst.de> |
---|---|
Subject: | Re: [PATCH 27/67] dma-direct: add dma address sanity checks |
From: | Geert Uytterhoeven <geert@linux-m68k.org> |
Date: | Fri, 29 Dec 2017 15:12:25 +0100 |
Cc: | iommu@lists.linux-foundation.org, Linux MIPS Mailing List <linux-mips@linux-mips.org>, linux-ia64@vger.kernel.org, Linux-sh list <linux-sh@vger.kernel.org>, sparclinux <sparclinux@vger.kernel.org>, Guan Xuetao <gxt@mprc.pku.edu.cn>, Linux-Arch <linux-arch@vger.kernel.org>, linux-s390 <linux-s390@vger.kernel.org>, linux-c6x-dev@linux-c6x.org, "open list:QUALCOMM HEXAGON..." <linux-hexagon@vger.kernel.org>, "the arch/x86 maintainers" <x86@kernel.org>, arcml <linux-snps-arc@lists.infradead.org>, adi-buildroot-devel@lists.sourceforge.net, linux-m68k <linux-m68k@lists.linux-m68k.org>, patches@groups.riscv.org, "open list:METAG ARCHITECTURE" <linux-metag@vger.kernel.org>, linux-arm-kernel@lists.infradead.org, Michal Simek <monstr@monstr.eu>, Parisc List <linux-parisc@vger.kernel.org>, Cris <linux-cris-kernel@axis.com>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, alpha <linux-alpha@vger.kernel.org>, linuxppc-dev@lists.ozlabs.org |
Dkim-signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=CngtFWMFI86iVviEXbcdKS12rxLXJpnUsJdUNn4d4fY=; b=XQnFdxGErOrDh/3KFwv/XPRIM7J3z3aoW8EU5Mp0bwyGaK5oU6UA7k+/HeXnIMgOlK 291ZzntnkxO4scZr3KkjYRSfMxxxRDEYcyv2LF1AYmaAKld/MPufIR70rfOQFZPdQRLV P+PJiK7RbTb9KWovxL6D0c0YAYVjeAIcaKMxVBtb9xwVze+NSUfk/CEqXQlKYqc36P/C fj1NKQ4r4KA3J+/6KZYyO6xAQavfbqFBxiGRGgk1MsVf8aV58DkPeXmM4EizSmstv3kO ewqEVNhC/VVCr1zcXk5fLG7W9cYXRduTJ/Pv6DIjo0R/rM9LW4iWm+6QLNGi7HY6yO6S XTvg== |
In-reply-to: | <20171229081911.2802-28-hch@lst.de> |
List-archive: | <http://www.linux-mips.org/archives/linux-mips/> |
List-help: | <mailto:ecartis@linux-mips.org?Subject=help> |
List-id: | linux-mips <linux-mips.eddie.linux-mips.org> |
List-owner: | <mailto:ralf@linux-mips.org> |
List-post: | <mailto:linux-mips@linux-mips.org> |
List-software: | Ecartis version 1.0.0 |
List-subscribe: | <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips> |
List-unsubscribe: | <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips> |
Original-recipient: | rfc822;linux-mips@linux-mips.org |
References: | <20171229081911.2802-1-hch@lst.de> <20171229081911.2802-28-hch@lst.de> |
Sender: | linux-mips-bounce@linux-mips.org |
Hi Christoph, On Fri, Dec 29, 2017 at 9:18 AM, Christoph Hellwig <hch@lst.de> wrote: > Roughly based on the x86 pci-nommu implementation. > > Signed-off-by: Christoph Hellwig <hch@lst.de> Thanks for your patch! > --- a/lib/dma-direct.c > +++ b/lib/dma-direct.c > @@ -9,6 +9,24 @@ > #include <linux/scatterlist.h> > #include <linux/pfn.h> > > +#define DIRECT_MAPPING_ERROR 0 > + > +static bool > +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 ... > + caller, (long long)dma_addr, size, ... and use &dma_addr. > + (long long)*dev->dma_mask); This cast is not needed, as u64 is unsigned long long in kernelspace on all architectures. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds |
Previous by Date: | Re: [PATCH v4 06/15] clk: Add Ingenic jz4770 CGU driver, Philippe Ombredanne |
---|---|
Next by Date: | Re: [PATCH v4 06/15] clk: Add Ingenic jz4770 CGU driver, Paul Cercueil |
Previous by Thread: | [PATCH 27/67] dma-direct: add dma address sanity checks, Christoph Hellwig |
Next by Thread: | [PATCH 28/67] dma-direct: add support for CMA allocation, Christoph Hellwig |
Indexes: | [Date] [Thread] [Top] [All Lists] |