lkml.org 
[lkml]   [2006]   [Nov]   [5]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateMon, 06 Nov 2006 02:44:31 +0530
FromBalbir Singh <>
SubjectRe: [ckrm-tech] [PATCH 6/6] Resource Groups over generic containers
Hi, Paul,

I've just started playing with the new patchset and found a few issues.

menage@google.com wrote:
> +ssize_t res_group_file_write(struct container *cont,
> +				   struct cftype *cft,
> +				   struct file *file,
> +				   const char __user *userbuf,
> +				   size_t nbytes, loff_t *ppos)
> +{
> +	struct res_group_cft *rgcft = container_of(cft, struct res_group_cft, cft);
> +	struct res_controller *ctlr = rgcft->ctlr;
> +
> +	if (nbytes >= PAGE_SIZE)
> +		return -E2BIG;
> +
> +	char *buf;
> +	ssize_t retval;
> +	int filetype = cft->private;
> +
> +	buf = kmalloc(nbytes + 1, GFP_USER);

This should be kmalloc(nbytes), an echo ".." has a "\n" associated
with it.

> +	if (!buf) return -ENOMEM;
> +	if (copy_from_user(buf, userbuf, nbytes)) {
> +		retval = -EFAULT;
> +		goto out1;
> +	}
> +	buf[nbytes] = 0;	/* nul-terminate */
> +

this should be buf[nbytes - 1]



-- 

	Balbir Singh,
	Linux Technology Center,
	IBM Software Labs
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-11-05 21:19    [from the cache]
©2003-2008