Re: [PATCH 1/1] mct_u232: IOCTL implementation

From: Pete Zaitcev
Date: Sun Dec 26 2010 - 12:48:58 EST


On Sat, 25 Dec 2010 21:39:39 -0800 (PST)
Tsozik <tsozik@xxxxxxxxx> wrote:

> +++ mct_u232.c 2010-12-25 21:44:57.714640343 -0500
> +static int mct_u232_ioctl(struct tty_struct *tty, struct file *file,
> + unsigned int cmd, unsigned long arg)
> +{
> + case TIOCGICOUNT:
> + dbg("%s - (%d) TIOCGICOUNT RX=%d, TX=%d", __func__,
> + port->number, mct_u232_port->icount.rx, mct_u232_port->icount.tx);
> + if (copy_to_user((void __user *)arg, &mct_u232_port->icount,
> + sizeof(mct_u232_port->icount)))
> + return -EFAULT;

This looks suspicious. Didn't we relocate the machinery for TIOCGICOUNT
into a generic place? Please examine how ->get_icount works before
hand-rolling the ioctl.

-- Pete
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/