[PATCH] fix SMBus write_byte ioctl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



i2c_smbus_xfer needs the structure i2c_smbus_data for write_byte with SW PEC.
However, NULL is passed from i2cdev_ioctl.
Currently
	ioctl(fd,I2C_PEC,1);
	i2c_smbus_write_byte(fd,value);
causes NULL pointer access in i2c_smbus_add_pec.

Index: kernel/i2c-dev.c
===================================================================
RCS file: /home/cvs/i2c/kernel/i2c-dev.c,v
retrieving revision 1.61
diff -u -r1.61 i2c-dev.c
--- kernel/i2c-dev.c	19 May 2005 20:50:29 -0000	1.61
+++ kernel/i2c-dev.c	25 Sep 2005 09:33:21 -0000
@@ -329,7 +329,8 @@
 			                      client->flags,
 			                      data_arg.read_write,
 			                      data_arg.command,
-			                      data_arg.size, NULL);
+			                      data_arg.size,
+			                      (data_arg.size == I2C_SMBUS_QUICK) ? NULL : &temp);
 
 		if (data_arg.data == NULL) {
 #ifdef DEBUG

----
Hideki IWAMOTO  h-iwamoto at kit.hi-ho.ne.jp




[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux