[lm-sensors] [PATCH 1/3] hwmon: (acpi_power_meter) Fix unintentional integer overflow
Guenter Roeck
linux at roeck-us.net
Thu Jun 21 15:56:53 CEST 2012
Expression with two integer variables is calculated as integer before it is
converted to u64. This may result in an integer overflow. Fix by declaring
the constant as ULL.
This patch addresses Coverity #200596: Unintentional integer overflow.
Signed-off-by: Guenter Roeck <linux at roeck-us.net>
---
drivers/hwmon/acpi_power_meter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c
index 9a0821f1..c8ac1c6 100644
--- a/drivers/hwmon/acpi_power_meter.c
+++ b/drivers/hwmon/acpi_power_meter.c
@@ -434,7 +434,7 @@ static ssize_t show_val(struct device *dev,
if (resource->trip[attr->index - 7] < 0)
return sprintf(buf, "unknown\n");
- val = resource->trip[attr->index - 7] * 1000;
+ val = resource->trip[attr->index - 7] * 1000ULL;
break;
default:
BUG();
--
1.7.9.7
More information about the lm-sensors
mailing list