Skip to content

Commit 52628a8

Browse files
Dan Carpenterrafaeljw
authored andcommitted
thermal: int340x: delete bogus length check
This check has a signedness bug and does not work. If "length" is larger than "PAGE_SIZE" then "PAGE_SIZE - length" is not negative but instead it is a large unsigned value. Fortunately, Takashi Iwai changed this code to use scnprint() instead of snprintf() so now "length" is never larger than "PAGE_SIZE - 1" and the check can be removed. Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 9e1ff30 commit 52628a8

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

drivers/thermal/intel/int340x_thermal/int3400_thermal.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,10 @@ static ssize_t available_uuids_show(struct device *dev,
129129

130130
for (i = 0; i < INT3400_THERMAL_MAXIMUM_UUID; i++) {
131131
if (priv->uuid_bitmap & (1 << i))
132-
if (PAGE_SIZE - length > 0)
133-
length += scnprintf(&buf[length],
134-
PAGE_SIZE - length,
135-
"%s\n",
136-
int3400_thermal_uuids[i]);
132+
length += scnprintf(&buf[length],
133+
PAGE_SIZE - length,
134+
"%s\n",
135+
int3400_thermal_uuids[i]);
137136
}
138137

139138
return length;

0 commit comments

Comments
 (0)