diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2021-09-30 14:28:03 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2021-10-05 16:46:27 +0200 |
commit | 52628a85dd8eb59dd04df73fc75f40ad85f1d720 (patch) | |
tree | c124b1b2b6e25add21a5427f75bb4d39e54bbb36 /drivers/thermal | |
parent | Linux 5.15-rc4 (diff) | |
download | linux-52628a85dd8eb59dd04df73fc75f40ad85f1d720.tar.xz linux-52628a85dd8eb59dd04df73fc75f40ad85f1d720.zip |
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 <dan.carpenter@oracle.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r-- | drivers/thermal/intel/int340x_thermal/int3400_thermal.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c index 19926beeb3b7..8502b7d8df89 100644 --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c @@ -129,11 +129,10 @@ static ssize_t available_uuids_show(struct device *dev, for (i = 0; i < INT3400_THERMAL_MAXIMUM_UUID; i++) { if (priv->uuid_bitmap & (1 << i)) - if (PAGE_SIZE - length > 0) - length += scnprintf(&buf[length], - PAGE_SIZE - length, - "%s\n", - int3400_thermal_uuids[i]); + length += scnprintf(&buf[length], + PAGE_SIZE - length, + "%s\n", + int3400_thermal_uuids[i]); } return length; |