linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joerg Roedel <joerg.roedel@amd.com>
To: Jan Luebbe <jlu@pengutronix.de>
Cc: <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] lib/dma-debug: check for vmalloc buffers used with the DMA-API
Date: Tue, 18 Sep 2012 15:18:42 +0200	[thread overview]
Message-ID: <20120918131842.GL2505@amd.com> (raw)
In-Reply-To: <1346670004-10248-1-git-send-email-jlu@pengutronix.de>

On Mon, Sep 03, 2012 at 01:00:04PM +0200, Jan Luebbe wrote:
> Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
> ---
> I'm not sure why we don't check for high memory, is there any problem
> with this approach?
> 
>  lib/dma-debug.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/lib/dma-debug.c b/lib/dma-debug.c
> index 66ce414..7d60ff0 100644
> --- a/lib/dma-debug.c
> +++ b/lib/dma-debug.c
> @@ -944,6 +944,9 @@ static void check_for_illegal_area(struct device *dev, void *addr, unsigned long
>  	if (overlap(addr, len, _text, _etext) ||
>  	    overlap(addr, len, __start_rodata, __end_rodata))
>  		err_printk(dev, NULL, "DMA-API: device driver maps memory from kernel text or rodata [addr=%p] [len=%lu]\n", addr, len);
> +	if (is_vmalloc_or_module_addr(addr) ||
> +	    is_vmalloc_or_module_addr(addr+len))
> +		err_printk(dev, NULL, "DMA-API: device driver maps memory from vmalloc or module address range [addr=%p] [len=%lu]\n", addr, len);

Hmm, this only checks whether the start or end+1 address is in the
vmalloc/module range. I think it is better to check for overlap against
VMALLOC_START/END and do a seperate overlap check for MODULES_VADDR and
MODULES_END when needed.

Thanks,

	Joerg

-- 
AMD Operating System Research Center

Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632


  reply	other threads:[~2012-09-18 13:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-03 11:00 Jan Luebbe
2012-09-18 13:18 ` Joerg Roedel [this message]
2012-09-19 15:28   ` [PATCH v2] lib/dma-debug: check for vmalloc and module addresses " Jan Luebbe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120918131842.GL2505@amd.com \
    --to=joerg.roedel@amd.com \
    --cc=jlu@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH] lib/dma-debug: check for vmalloc buffers used with the DMA-API' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).