Skip to content

Commit 76c9e46

Browse files
committed
Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c fixes from Wolfram Sang: "One driver bugfix, a documentation bugfix, and an "uninitialized data" leak fix for the core" * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: Documentation: i2c: add i2c-sysfs into index i2c: dev: zero out array used for i2c reads from userspace i2c: iproc: fix race between client unreg and tasklet
2 parents ba31f97 + 3f12cc4 commit 76c9e46

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

Documentation/i2c/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Introduction
1717
busses/index
1818
i2c-topology
1919
muxes/i2c-mux-gpio
20+
i2c-sysfs
2021

2122
Writing device drivers
2223
======================

drivers/i2c/busses/i2c-bcm-iproc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,14 +1224,14 @@ static int bcm_iproc_i2c_unreg_slave(struct i2c_client *slave)
12241224

12251225
disable_irq(iproc_i2c->irq);
12261226

1227+
tasklet_kill(&iproc_i2c->slave_rx_tasklet);
1228+
12271229
/* disable all slave interrupts */
12281230
tmp = iproc_i2c_rd_reg(iproc_i2c, IE_OFFSET);
12291231
tmp &= ~(IE_S_ALL_INTERRUPT_MASK <<
12301232
IE_S_ALL_INTERRUPT_SHIFT);
12311233
iproc_i2c_wr_reg(iproc_i2c, IE_OFFSET, tmp);
12321234

1233-
tasklet_kill(&iproc_i2c->slave_rx_tasklet);
1234-
12351235
/* Erase the slave address programmed */
12361236
tmp = iproc_i2c_rd_reg(iproc_i2c, S_CFG_SMBUS_ADDR_OFFSET);
12371237
tmp &= ~BIT(S_CFG_EN_NIC_SMB_ADDR3_SHIFT);

drivers/i2c/i2c-dev.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ static ssize_t i2cdev_read(struct file *file, char __user *buf, size_t count,
141141
if (count > 8192)
142142
count = 8192;
143143

144-
tmp = kmalloc(count, GFP_KERNEL);
144+
tmp = kzalloc(count, GFP_KERNEL);
145145
if (tmp == NULL)
146146
return -ENOMEM;
147147

@@ -150,7 +150,8 @@ static ssize_t i2cdev_read(struct file *file, char __user *buf, size_t count,
150150

151151
ret = i2c_master_recv(client, tmp, count);
152152
if (ret >= 0)
153-
ret = copy_to_user(buf, tmp, count) ? -EFAULT : ret;
153+
if (copy_to_user(buf, tmp, ret))
154+
ret = -EFAULT;
154155
kfree(tmp);
155156
return ret;
156157
}

0 commit comments

Comments
 (0)