mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Masayuki Ohtake" <masa-korg@dsn.okisemi.com>
To: "Arnd Bergmann" <arnd@arndb.de>
Cc: <andrew.chih.howe.khor@intel.com>, <joel.clark@intel.com>,
	"Wang, Yong Y" <yong.y.wang@intel.com>, <qi.wang@intel.com>,
	"LKML" <linux-kernel@vger.kernel.org>,
	<linux-i2c@vger.kernel.org>,
	"Ben Dooks \(embedded platforms\)" <ben-linux@fluff.org>,
	"Jean Delvare \(PC drivers, core\)" <khali@linux-fr.org>
Subject: Re: [PATCH] I2C driver of Topcliff PCH
Date: Tue, 20 Jul 2010 21:40:00 +0900	[thread overview]
Message-ID: <000d01cb2808$ac78d300$66f8800a@maildom.okisemi.com> (raw)
In-Reply-To: <201007201129.53110.arnd@arndb.de>

Hi Arnd,

> That is a highly unusual interface and I would definitely not recommend doing
> this. Please use an ioctl operation for anything that has both input and output
> data.
I will delete the special interface from our i2c driver.

Thanks, Ohtake
----- Original Message ----- 
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Masayuki Ohtake" <masa-korg@dsn.okisemi.com>
Cc: <andrew.chih.howe.khor@intel.com>; <joel.clark@intel.com>; "Wang, Yong Y" <yong.y.wang@intel.com>;
<qi.wang@intel.com>; "LKML" <linux-kernel@vger.kernel.org>; <linux-i2c@vger.kernel.org>; "Ben Dooks (embedded
platforms)" <ben-linux@fluff.org>; "Jean Delvare (PC drivers, core)" <khali@linux-fr.org>
Sent: Tuesday, July 20, 2010 6:29 PM
Subject: Re: [PATCH] I2C driver of Topcliff PCH


> On Tuesday 20 July 2010, Masayuki Ohtake wrote:
> > > > @@ -147,6 +148,11 @@ static ssize_t i2cdev_read(struct file *file, char __user *buf, size_t count,
> > > >  if (tmp == NULL)
> > > >  return -ENOMEM;
> > > >
> > > > + if (copy_from_user(tmp, buf, count)) {
> > > > + kfree(tmp);
> > > > + return -EFAULT;
> > > > + }
> > > > +
> > > >  pr_debug("i2c-dev: i2c-%d reading %zu bytes.\n",
> > > >  iminor(file->f_path.dentry->d_inode), count);
> > >
> > >
> > > A read function should not do copy_from_user, only copy_to_user.
> > > If you are worried about returning invalid data from kernel space,
> > > better use kzalloc instead of kmalloc to get the buffer.
> >
> > Our I2C HW has special mode.
> > To control the mode, our i2c driver has copy_from_user.
>
> That is a highly unusual interface and I would definitely not recommend doing
> this. Please use an ioctl operation for anything that has both input and output
> data.
>
> Arnd
>



  reply	other threads:[~2010-07-20 12:40 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-22  5:33 [PATCH] Topcliff PHUB: Generate PacketHub driver Masayuki Ohtak
2010-06-22 10:33 ` Masayuki Ohtak
2010-06-22 22:12   ` Andrew Morton
2010-06-23  0:31     ` Masayuki Ohtake
2010-06-22 11:30 ` Arnd Bergmann
2010-06-22 13:52   ` Yong Wang
2010-06-29 23:31 ` Andy Isaacson
2010-06-30  5:58   ` Masayuki Ohtake
2010-06-30 18:28     ` Andy Isaacson
2010-07-01  4:08       ` Masayuki Ohtake
2010-06-30  7:51 ` [PATCH] Packet hub driver of Topcliff PCH Masayuki Ohtak
2010-06-30 18:05   ` Randy Dunlap
2010-07-01  2:52     ` Masayuki Ohtake
2010-07-01  5:14 ` Masayuki Ohtak
2010-07-01  6:58   ` Andy Isaacson
2010-07-01 10:13     ` Masayuki Ohtake
2010-07-01 10:38 ` Masayuki Ohtak
2010-07-01 15:44   ` Randy Dunlap
2010-07-05  7:20 ` Masayuki Ohtak
2010-07-05 15:04   ` Arnd Bergmann
2010-07-06 15:58   ` Randy Dunlap
2010-07-06  6:20 ` Masayuki Ohtak
2010-07-06  6:30   ` Arnd Bergmann
2010-07-07  1:19     ` Yong Wang
2010-07-09 20:00   ` Andrew Morton
2010-07-12  1:25     ` Masayuki Ohtake
2010-07-15  7:25 ` Masayuki Ohtak
2010-07-15  7:42 ` [PATCH] I2C " Masayuki Ohtak
2010-07-15 19:35   ` Arnd Bergmann
2010-07-20  0:05     ` Masayuki Ohtake
2010-07-20  4:55     ` Masayuki Ohtake
2010-07-20  9:27       ` Arnd Bergmann
2010-07-20 12:38         ` Masayuki Ohtake
2010-07-20  8:19     ` Masayuki Ohtake
2010-07-20  9:29       ` Arnd Bergmann
2010-07-20 12:40         ` Masayuki Ohtake [this message]
2010-07-21  6:46 ` Masayuki Ohtak

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='000d01cb2808$ac78d300$66f8800a@maildom.okisemi.com' \
    --to=masa-korg@dsn.okisemi.com \
    --cc=andrew.chih.howe.khor@intel.com \
    --cc=arnd@arndb.de \
    --cc=ben-linux@fluff.org \
    --cc=joel.clark@intel.com \
    --cc=khali@linux-fr.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=qi.wang@intel.com \
    --cc=yong.y.wang@intel.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

all inboxes | Powered by JetHome®