[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180823074956.770806536@linuxfoundation.org>
Date: Thu, 23 Aug 2018 09:51:23 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org,
Paul Menzel <pmenzel+linux-hwmon@...gen.mpg.de>,
Guenter Roeck <linux@...ck-us.net>,
Sasha Levin <alexander.levin@...rosoft.com>
Subject: [PATCH 4.17 017/324] hwmon: (nct6775) Fix loop limit
4.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <linux@...ck-us.net>
[ Upstream commit 91bb8f45f73f19a0150c233c0f11cdeb6d71d1e9 ]
Commit cc66b3038254 ("hwmon: (nct6775) Rework temperature source and label
handling") changed a loop limit from "data->temp_label_num - 1" to "32",
as part of moving from a string array to a bit mask. This results in the
following error, reported by UBSAN.
UBSAN: Undefined behaviour in drivers/hwmon/nct6775.c:4179:27
shift exponent 32 is too large for 32-bit type 'long unsigned int'
Similar to the original loop, the limit has to be one less than the
number of bits.
Fixes: cc66b3038254 ("hwmon: (nct6775) Rework temperature source and label handling")
Reported-by: Paul Menzel <pmenzel+linux-hwmon@...gen.mpg.de>
Cc: Paul Menzel <pmenzel+linux-hwmon@...gen.mpg.de>
Tested-by: Paul Menzel <pmenzel+linux-hwmon@...gen.mpg.de>
Signed-off-by: Guenter Roeck <linux@...ck-us.net>
Signed-off-by: Sasha Levin <alexander.levin@...rosoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/hwmon/nct6775.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/hwmon/nct6775.c
+++ b/drivers/hwmon/nct6775.c
@@ -4175,7 +4175,7 @@ static int nct6775_probe(struct platform
* The temperature is already monitored if the respective bit in <mask>
* is set.
*/
- for (i = 0; i < 32; i++) {
+ for (i = 0; i < 31; i++) {
if (!(data->temp_mask & BIT(i + 1)))
continue;
if (!reg_temp_alternate[i])
Powered by blists - more mailing lists