Skip to content

Commit 3fd1bb9

Browse files
Jean DelvareLinus Torvalds
authored andcommitted
[PATCH] hwmon: Off-by-one error in fscpos driver
Coverity uncovered an off-by-one error in the fscpos driver, in function set_temp_reset(). Writing to the temp3_reset sysfs file will lead to an array overrun, in turn causing an I2C write to a random register of the FSC Poseidon chip. Additionally, writing to temp1_reset and temp2_reset will not work as expected. The fix is straightforward. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 566ecb9 commit 3fd1bb9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/hwmon/fscpos.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ static ssize_t set_temp_reset(struct i2c_client *client, struct fscpos_data
167167
"experience to the module author.\n");
168168

169169
/* Supported value: 2 (clears the status) */
170-
fscpos_write_value(client, FSCPOS_REG_TEMP_STATE[nr], 2);
170+
fscpos_write_value(client, FSCPOS_REG_TEMP_STATE[nr - 1], 2);
171171
return count;
172172
}
173173

0 commit comments

Comments
 (0)