Skip to contentSkip to conversation

hwmon: (nct6775) make an array larger

PATCH Applied Dan Carpenter 2 participants 2 messages Jul 18, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hwmon: (nct6775) make an array larger

Smatch complains that we have a array overflow:

	drivers/hwmon/nct6775.c:1456 nct6775_update_device()
		error: buffer overflow 'data->temp' 4 <= 4

Guenter Roeck says that the array should have been made larger in 7cbbd6aee6 (Add support for critical low/high temperature limits on NCT6106). This patch does that.

---
v2: the first version was wrong

drivers/hwmon/nct6775.c +2 -2
index f0941d7..25e2c7b 100644
@@ -813,8 +813,8 @@ struct nct6775_data {
 	u8 temp_fixed_num;	/* 3 or 6 */
 	u8 temp_type[NUM_TEMP_FIXED];
 	s8 temp_offset[NUM_TEMP_FIXED];
-	s16 temp[4][NUM_TEMP]; /* 0=temp, 1=temp_over, 2=temp_hyst,
-				* 3=temp_crit */
+	s16 temp[5][NUM_TEMP]; /* 0=temp, 1=temp_over, 2=temp_hyst,
+				* 3=temp_crit, 4=temp_lcrit */
 	u64 alarms;
 	u64 beeps;
 
maintainer Applied
#1 lore raw
Quoted 10 lines · Dan Carpenter

Smatch complains that we have a array overflow:

	drivers/hwmon/nct6775.c:1456 nct6775_update_device()
		error: buffer overflow 'data->temp' 4 <= 4

Guenter Roeck says that the array should have been made larger in 7cbbd6aee6 (Add support for critical low/high temperature limits on NCT6106). This patch does that.

Applied. Thanks a lot for the patch.

I really need to enable smatch on my nightly builds :(

Guenter