public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Balbir Singh <balbir@in.ibm.com>
To: menage@google.com
Cc: sekharan@us.ibm.com, ckrm-tech@lists.sourceforge.net, pj@sgi.com,
	akpm@osdl.org, jlan@sgi.com, mbligh@google.com,
	rohitseth@google.com, winget@google.com, Simon.Derr@bull.net,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [ckrm-tech] [PATCH 6/6] Resource Groups over generic containers
Date: Mon, 06 Nov 2006 02:44:31 +0530	[thread overview]
Message-ID: <454E5437.1020909@in.ibm.com> (raw)
In-Reply-To: <20061004235752.935272000@menage.corp.google.com>

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

       reply	other threads:[~2006-11-05 21:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20061004234316.677837000@menage.corp.google.com>
     [not found] ` <20061004235752.935272000@menage.corp.google.com>
2006-11-05 21:14   ` Balbir Singh [this message]
2006-11-05 21:34     ` [ckrm-tech] [PATCH 6/6] Resource Groups over generic containers Paul Jackson
2006-11-06  5:06       ` Balbir Singh
2006-11-06  5:07       ` Balbir Singh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=454E5437.1020909@in.ibm.com \
    --to=balbir@in.ibm.com \
    --cc=Simon.Derr@bull.net \
    --cc=akpm@osdl.org \
    --cc=ckrm-tech@lists.sourceforge.net \
    --cc=jlan@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbligh@google.com \
    --cc=menage@google.com \
    --cc=pj@sgi.com \
    --cc=rohitseth@google.com \
    --cc=sekharan@us.ibm.com \
    --cc=winget@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox