Re: [PATCH 1/4] mm: cma: add currently allocated CMA buffers list to debugfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]