From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f48.google.com (mail-pa0-f48.google.com [209.85.220.48]) by kanga.kvack.org (Postfix) with ESMTP id 677416B0073 for ; Thu, 12 Feb 2015 22:13:58 -0500 (EST) Received: by mail-pa0-f48.google.com with SMTP id eu11so15788657pac.7 for ; Thu, 12 Feb 2015 19:13:58 -0800 (PST) Received: from lgeamrelo04.lge.com (lgeamrelo04.lge.com. [156.147.1.127]) by mx.google.com with ESMTP id zc3si1118729pbb.136.2015.02.12.19.13.56 for ; Thu, 12 Feb 2015 19:13:57 -0800 (PST) Date: Fri, 13 Feb 2015 12:16:14 +0900 From: Joonsoo Kim Subject: Re: [PATCH 1/4] mm: cma: add currently allocated CMA buffers list to debugfs Message-ID: <20150213031613.GJ6592@js1304-P5Q-DELUXE> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org List-ID: To: Stefan Strogin Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Marek Szyprowski , Michal Nazarewicz , aneesh.kumar@linux.vnet.ibm.com, Laurent Pinchart , Dmitry Safonov , Pintu Kumar , Weijie Yang , Laura Abbott , SeongJae Park , Hui Zhu , Minchan Kim , Dyasly Sergey , Vyacheslav Tyrtov , gregory.0xf0@gmail.com, sasha.levin@oracle.com, gioh.kim@lge.com, pavel@ucw.cz, stefan.strogin@gmail.com On Fri, Feb 13, 2015 at 01:15:41AM +0300, Stefan Strogin wrote: > static int cma_debugfs_get(void *data, u64 *val) > { > unsigned long *p = data; > @@ -125,6 +221,52 @@ static int cma_alloc_write(void *data, u64 val) > > DEFINE_SIMPLE_ATTRIBUTE(cma_alloc_fops, NULL, cma_alloc_write, "%llu\n"); > > +static int cma_buffers_read(struct file *file, char __user *userbuf, > + size_t count, loff_t *ppos) > +{ > + struct cma *cma = file->private_data; > + struct cma_buffer *cmabuf; > + struct stack_trace trace; > + char *buf; > + int ret, n = 0; > + > + if (*ppos < 0 || !count) > + return -EINVAL; > + > + buf = kmalloc(count, GFP_KERNEL); > + if (!buf) > + return -ENOMEM; Is count limited within proper size boundary for kmalloc()? If it can exceed page size, using vmalloc() is better than this. Thanks. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org