Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752513Ab0LZRsy (ORCPT ); Sun, 26 Dec 2010 12:48:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:10375 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752412Ab0LZRsx (ORCPT ); Sun, 26 Dec 2010 12:48:53 -0500 Date: Sun, 26 Dec 2010 10:49:05 -0700 From: Pete Zaitcev To: Tsozik Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] mct_u232: IOCTL implementation Message-ID: <20101226104905.6801612f@lembas.zaitcev.lan> In-Reply-To: <985550.24725.qm@web65704.mail.ac4.yahoo.com> References: <985550.24725.qm@web65704.mail.ac4.yahoo.com> Organization: Red Hat, Inc. Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1056 Lines: 24 On Sat, 25 Dec 2010 21:39:39 -0800 (PST) Tsozik 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/