[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <000001ccf17e$c3e50040$4baf00c0$%szyprowski@samsung.com>
Date: Wed, 22 Feb 2012 17:26:43 +0100
From: Marek Szyprowski <m.szyprowski@...sung.com>
To: 'Aaro Koskinen' <aaro.koskinen@....fi>
Cc: linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-media@...r.kernel.org, linux-mm@...ck.org,
linaro-mm-sig@...ts.linaro.org,
'Michal Nazarewicz' <mina86@...a86.com>,
'Kyungmin Park' <kyungmin.park@...sung.com>,
'Russell King' <linux@....linux.org.uk>,
'Andrew Morton' <akpm@...ux-foundation.org>,
'KAMEZAWA Hiroyuki' <kamezawa.hiroyu@...fujitsu.com>,
'Daniel Walker' <dwalker@...eaurora.org>,
'Mel Gorman' <mel@....ul.ie>, 'Arnd Bergmann' <arnd@...db.de>,
'Jesse Barker' <jesse.barker@...aro.org>,
'Jonathan Corbet' <corbet@....net>,
'Shariq Hasnain' <shariq.hasnain@...aro.org>,
'Chunsang Jeong' <chunsang.jeong@...aro.org>,
'Dave Hansen' <dave@...ux.vnet.ibm.com>,
'Benjamin Gaignard' <benjamin.gaignard@...aro.org>,
'Rob Clark' <rob.clark@...aro.org>,
'Ohad Ben-Cohen' <ohad@...ery.com>
Subject: RE: [PATCHv22 13/16] drivers: add Contiguous Memory Allocator
Hello,
On Tuesday, February 21, 2012 10:30 PM Aaro Koskinen wrote:
> On Fri, 17 Feb 2012, Marek Szyprowski wrote:
> > +/**
> > + * dma_release_from_contiguous() - release allocated pages
> > + * @dev: Pointer to device for which the pages were allocated.
> > + * @pages: Allocated pages.
> > + * @count: Number of allocated pages.
> > + *
> > + * This function releases memory allocated by dma_alloc_from_contiguous().
> > + * It returns false when provided pages do not belong to contiguous area and
> > + * true otherwise.
> > + */
> > +bool dma_release_from_contiguous(struct device *dev, struct page *pages,
> > + int count)
> > +{
> > + struct cma *cma = dev_get_cma_area(dev);
> > + unsigned long pfn;
> > +
> > + if (!cma || !pages)
> > + return false;
> > +
> > + pr_debug("%s(page %p)\n", __func__, (void *)pages);
> > +
> > + pfn = page_to_pfn(pages);
> > +
> > + if (pfn < cma->base_pfn || pfn >= cma->base_pfn + cma->count)
> > + return false;
> > +
> > + VM_BUG_ON(pfn + count > cma->base_pfn);
>
> Are you sure the VM_BUG_ON() condition is correct here?
Thanks for pointing this bug. '+ cma->count' is missing in the second part.
Best regards
--
Marek Szyprowski
Samsung Poland R&D Center
--
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