Commit 8e05a7d098c2dfd7cf3f0ee655727815da30866d

Con Kolivas 2014-02-01T22:30:17

Add sanity check for silly overflows in hfa die temperature readings.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/driver-hashfast.c b/driver-hashfast.c
index 3eb69c6..11c4a17 100644
--- a/driver-hashfast.c
+++ b/driver-hashfast.c
@@ -677,6 +677,9 @@ static void hfa_update_die_status(struct cgpu_info *hashfast, struct hashfast_in
 		int die = h->chip_address + i;
 
 		die_temperature = GN_DIE_TEMPERATURE(d->die.die_temperature);
+		/* Sanity checking */
+		if (unlikely(die_temperature > 255))
+			die_temperature = info->die_data[die].temp;
 		info->die_data[die].temp = die_temperature;
 		if (die_temperature > info->max_temp)
 			info->max_temp = die_temperature;