From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC740352027; Sat, 30 May 2026 17:00:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780160407; cv=none; b=M4NvGrAY0fyQELdRInKQxO0Ez50wao4GSWXzilwONk7e4WZfSS43r3pjI5E+H9Q7ngJzhfTgLbFoYeBXYV9PuTweV3J/8ZuVIXxGows2a0tpNsyrLQfqSE50TlZqqgPLmIywXdNBqiAWe2NGuTPnMiaVXRvRSPzuh1ootes1D64= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780160407; c=relaxed/simple; bh=EgeM0Z0WYFNmcMEE0hSYodN9hG/PhB4X/10hRzJ3vZQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q19Z49+r4heG4Sp0v906rKKom0EPrqMhQ3FYBN75MFYGJMu7227Asg+UXXP0sxN7hMKs8+8/xoJ3IMGlPepHkNo3Jj9nFHYrZ3GUax8NRWdKzb0QgcxePkCSh1OWjwp1xFVavCYpQ+5gW65+q0gHTgDToIkv+li2fULxaSCHCCE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=WTkOVnDf; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="WTkOVnDf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA4231F00893; Sat, 30 May 2026 17:00:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780160406; bh=GWvx9f7H1N8+7D7Y4Ip/GXu+WwarQ5+y1UvUdneU+Zg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=WTkOVnDf024O4IUlxNPbKRS04NBoYKzx2Xztg88Exe9rhRtq6L7QLGorQeG9I1KnJ 1CLAnkLrQL7weaZcsTBG+vtlkw8SEzgA7Sz5v56mvwwtEOzSE/Rs+2ToOoyyr6BBKs iUR6CYnkgkndju9K+8UFvxj9Apm8B7lXBeoBLtU4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sanman Pradhan , Guenter Roeck Subject: [PATCH 6.1 329/969] hwmon: (ltc2992) Fix u32 overflow in power read path Date: Sat, 30 May 2026 17:57:33 +0200 Message-ID: <20260530160309.470268527@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160300.485627683@linuxfoundation.org> References: <20260530160300.485627683@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sanman Pradhan commit 2da0c1fd01dbd6b22844e8676585153dfc660cbe upstream. ltc2992_get_power() computes the divisor for mul_u64_u32_div() as r_sense_uohm * 1000. This multiplication overflows u32 when r_sense_uohm exceeds about 4.29 ohms (4294967 micro-ohms), producing a truncated divisor and an incorrect power reading. Cancel the factor of 1000 from both the numerator (VADC_UV_LSB * IADC_NANOV_LSB = 312500000) and the divisor (r_sense_uohm * 1000), giving (VADC_UV_LSB / 1000) * IADC_NANOV_LSB = 312500 as the numerator and plain r_sense_uohm as the divisor. The cancellation is exact because LTC2992_VADC_UV_LSB (25000) is divisible by 1000. This is the read-path counterpart of the write-path fix applied in the preceding patch. Fixes: b0bd407e94b03 ("hwmon: (ltc2992) Add support") Cc: stable@vger.kernel.org Signed-off-by: Sanman Pradhan Link: https://lore.kernel.org/r/20260416215904.101969-3-sanman.pradhan@hpe.com Signed-off-by: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/ltc2992.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/hwmon/ltc2992.c +++ b/drivers/hwmon/ltc2992.c @@ -627,8 +627,10 @@ static int ltc2992_get_power(struct ltc2 if (reg_val < 0) return reg_val; - *val = mul_u64_u32_div(reg_val, LTC2992_VADC_UV_LSB * LTC2992_IADC_NANOV_LSB, - st->r_sense_uohm[channel] * 1000); + *val = mul_u64_u32_div(reg_val, + LTC2992_VADC_UV_LSB / 1000 * + LTC2992_IADC_NANOV_LSB, + st->r_sense_uohm[channel]); return 0; }