lkml.org 
[lkml]   [2010]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [BUG][PATCH]dma-coherent.c: error path bug
From
On Sun, 6 Jun 2010 13:53:04 +0300
Marin Mitov <mitov@issp.bas.bg> wrote:

> Hi all,
>
> The error path in dma_declare_coherent_memory() leaves
> the pointer dev->dma_mem non completely initialized.
>
> If allocation of dev->dma_mem succeeds,
> but allocation of dev->dma_mem->bitmap fails
> dev->dma_mem is freed, but left non NULL
> and non completely initialized.
>
> Either zero it after being freed (one liner patch), or assign to
> dev->dma_mem only completely initialized structure (patch included).
>
> Comments welcome.
>
> Marin Mitov
>
> Signed-off-by: Marin Mitov <mitov@issp.bas.bg>

Hmm, if dma_declare_coherent_memory() fails, the driver doesn't use
dev->dma_mem. So even if dev->dma_mem points to a freed memory, I'm
not sure that it causes a real problem. We could call this patch a
cleanup though.


\
 
 \ /
  Last update: 2010-06-07 04:35    [from the cache]
©2003-2011 Jasper Spaans