Skip to contentSkip to conversation

hwmon: Off-by-one error in fscpos driver

PATCH New Jean Delvare 1 participant 1 message Aug 25, 2005 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: Off-by-one error in fscpos driver

Hi Linus, all,

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.

This patch is a candidate for 2.6.13 (or 2.6.13.1 if it's too late for 2.6.13.)

Thanks.

 drivers/hwmon/fscpos.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/fscpos.c +1 -1
@@ -167,7 +167,7 @@
 				"experience to the module author.\n");
 
 	/* Supported value: 2 (clears the status) */
-	fscpos_write_value(client, FSCPOS_REG_TEMP_STATE[nr], 2);
+	fscpos_write_value(client, FSCPOS_REG_TEMP_STATE[nr - 1], 2);
 	return count;
 }
 
Signature · 1 line
Jean Delvare