public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: Alexander Atanasov <alex@ssi.bg>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] I2C block read
Date: Wed, 7 Jun 2006 19:49:43 +0200	[thread overview]
Message-ID: <20060607194943.db8f1889.khali@linux-fr.org> (raw)
In-Reply-To: <20060607203357.64432ad8.alex@ssi.bg>

Hi Alexander,

> 	When doing i2c block read the lenght is passed as the first byte of the buffer,
> so we must copy it from user otherwise temp is uninitialized.

> --- drivers/i2c/i2c-dev.c.orig	2006-01-04 02:00:00.000000000 +0200
> +++ drivers/i2c/i2c-dev.c	2006-06-07 19:46:08.000000000 +0300
> @@ -337,6 +337,7 @@
>  
>  		if ((data_arg.size == I2C_SMBUS_PROC_CALL) || 
>  		    (data_arg.size == I2C_SMBUS_BLOCK_PROC_CALL) || 
> +		    (data_arg.size == I2C_SMBUS_BLOCK_DATA) ||
>  		    (data_arg.read_write == I2C_SMBUS_WRITE)) {
>  			if (copy_from_user(&temp, data_arg.data, datasize))
>  				return -EFAULT;

Nack. Firstly, your comment says I2C block read, but your code changes
SMBus block read. These are two different transactions. Secondly, for
SMBus block read, the master doesn't ask for a given number of bytes.
Instead, the chip decides and returns the number of (following) bytes as
the first byte of the read part of the transaction. Check the SMBus
specification.

So your patch is not correct, sorry.

-- 
Jean Delvare

  reply	other threads:[~2006-06-07 17:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-07 17:33 [PATCH] I2C block read Alexander Atanasov
2006-06-07 17:49 ` Jean Delvare [this message]
2006-06-07 18:06   ` Alexander Atanasov
2006-06-07 18:50     ` Jean Delvare
2006-06-07 19:53       ` Jordan Crouse
2006-06-08 13:29       ` [PATCH] " Alexander Atanasov
2006-06-11 13:30         ` Jean Delvare
2006-06-12 14:16           ` Alexander Atanasov

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=20060607194943.db8f1889.khali@linux-fr.org \
    --to=khali@linux-fr.org \
    --cc=alex@ssi.bg \
    --cc=linux-kernel@vger.kernel.org \
    /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