Hi, Paul,
I've just started playing with the new patchset and found a few issues.
[email protected] 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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]