Aurelien Jarno wrote:
On Sat, Mar 05, 2005 at 11:19:40AM +0100, Benoit Hamet wrote:

Hi Aurelien,
Aurelien Jarno wrote:

I have check on my system, the definition of i2c_adapter is the same in
/usr/src/kernel-headers-2.4.27-2/linux/i2c.h and in
/usr/src/modules/i2c/kernel/i2c.h. The ABI is the same, and a driver
build with one or with the other header should work.

The main funtions are the same I agree, but take a close look at the sizeof(struct adapter) and you will see that there _is_ a difference which conduct to a kind of buffer overflow :/

If you want I can c&p the 2 structures.

Yes, it would be nice, because a diff between the two files listed above shows me that there is no difference concerning the structures.


]$ diff kernel-source-2.4.27/include/linux/i2c.h
kernel-headers-2.4.27-2-k6/include/linux/i2c.h
]$ vi kernel-source-2.4.27/include/linux/i2c.h module/i2c/kernel/i2c.h

In modules/i2c/kernel/i2c.h :
line 246 you get :
          void *data;     /* private data for the adapter
   */
                          /* some data fields that are used by all
types  */
                          /* these data fields are readonly to the
public */
                          /* and can be set via the i2c_ioctl call
   */

                          /* data fields that are valid for all devices
  */
          struct semaphore bus;
          struct semaphore list;
          unsigned int flags;/* flags specifying div. data
   */

when in kernel-source-2.4.27/include/linux/i2c.h
you get :
line 244 :
        void *data;     /* private data for the adapter                 */
                        /* some data fields that are used by all types  */
                        /* these data fields are readonly to the public */
                        /* and can be set via the i2c_ioctl call        */

                        /* data fields that are valid for all devices   */
        struct semaphore lock;
        unsigned int flags;/* flags specifying div. data                */
AND
Then take a look at line 251 in module/i2c/kernel/i2c.h
         struct i2c_client *clients[I2C_CLIENT_MAX];

          int timeout;

when at line 248 you get in kernel-source-2.4.27/include/i2c.h
        struct i2c_client *clients[I2C_CLIENT_MAX];
        int client_count;

        int timeout;

Hope that you get it :]
I think that perhaps if struct semaphore is the same size of int
client_count, then perhaps the size are the same, but I would be really
surprised if this was the case:
Just in case :
904d5171ac343b10f4d0ac8c86d316b8  modules/i2c/kernel/i2c.h
7845d52b834f6309a4f040f7ef1f6968
kernel-headers-2.4.27-2-k6/include/linux/i2c.h

Regards,
Benoit

Attachment: signature.asc
Description: OpenPGP digital signature



Reply via email to