[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20081122093908.GI29705@8bytes.org>
Date: Sat, 22 Nov 2008 10:39:08 +0100
From: Joerg Roedel <joro@...tes.org>
To: FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>
Cc: joerg.roedel@....com, netdev@...r.kernel.org, tglx@...utronix.de,
mingo@...hat.com, linux-kernel@...r.kernel.org,
iommu@...ts.linux-foundation.org
Subject: Re: [PATCH 05/10] x86: add check code for map/unmap_single code
On Sat, Nov 22, 2008 at 12:27:41PM +0900, FUJITA Tomonori wrote:
> On Fri, 21 Nov 2008 17:26:05 +0100
> Joerg Roedel <joerg.roedel@....com> wrote:
>
> > Impact: detect bugs in map/unmap_single usage
> >
> > Signed-off-by: Joerg Roedel <joerg.roedel@....com>
> > ---
> > arch/x86/include/asm/dma-mapping.h | 9 +++++-
> > arch/x86/include/asm/dma_debug.h | 20 +++++++++++++
> > arch/x86/kernel/pci-dma-debug.c | 55 ++++++++++++++++++++++++++++++++++++
> > 3 files changed, 83 insertions(+), 1 deletions(-)
> >
> > diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
> > index 83d7b7d..c9bead2 100644
> > --- a/arch/x86/include/asm/dma-mapping.h
> > +++ b/arch/x86/include/asm/dma-mapping.h
> > @@ -98,9 +98,14 @@ dma_map_single(struct device *hwdev, void *ptr, size_t size,
> > int direction)
> > {
> > struct dma_mapping_ops *ops = get_dma_ops(hwdev);
> > + dma_addr_t addr;
> >
> > BUG_ON(!valid_dma_direction(direction));
> > - return ops->map_single(hwdev, virt_to_phys(ptr), size, direction);
> > + addr = ops->map_single(hwdev, virt_to_phys(ptr), size, direction);
> > +
> > + debug_map_single(hwdev, ptr, size, direction, addr);
>
> debug_map_single could fail due to OOM. Then debug_unmap_single in
> dma_unmap_single gives a false warning because it can't find the
> dma_debug_entry?
True. I will add a check to disable checking when a map operation has
failed.
Joerg
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists