From: Guenter Roeck <linux@roeck-us.net>
To: "Pradhan, Sanman" <sanman.pradhan@hpe.com>
Cc: "linux-hwmon@vger.kernel.org" <linux-hwmon@vger.kernel.org>,
"robh@kernel.org" <robh@kernel.org>,
"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
"krzk@kernel.org" <krzk@kernel.org>,
"conor+dt@kernel.org" <conor+dt@kernel.org>,
"corbet@lwn.net" <corbet@lwn.net>,
"skhan@linuxfoundation.org" <skhan@linuxfoundation.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Sanman Pradhan <psanman@juniper.net>,
Georgi Vlaev <gvlaev@juniper.net>,
Dhruva Devineni <ddevineni@juniper.net>,
Debjit Ghosh <dghosh@juniper.net>,
Jawahar Balaji Thirumalaisamy <jawaharb@juniper.net>,
Avadhut Naik <avadhutn@juniper.net>,
Santhanakrishnan Balraj <sbalraj@juniper.net>,
Brian Mak <makb@juniper.net>
Subject: Re: [PATCH v3 2/2] hwmon: (pmbus/vt7505) Add driver for Analog Devices MAX16545/MAX16550 and Volterra VT7505
Date: Fri, 24 Jul 2026 10:27:03 -0700 [thread overview]
Message-ID: <ff49ae92-cff8-489b-b702-9d8fb8dd4c69@roeck-us.net> (raw)
In-Reply-To: <20260724164919.247162-3-sanman.pradhan@hpe.com>
On Fri, Jul 24, 2026 at 04:50:00PM +0000, Pradhan, Sanman wrote:
> From: Georgi Vlaev <gvlaev@juniper.net>
>
> Add a PMBus driver for the Analog Devices MAX16545 and MAX16550, and the
> Volterra VT7505 controllers. The driver reports input/output voltage,
> input/output current, input power and temperature over PMBus. All values
> use the direct data format. Peak input voltage, output voltage, output
> current, input power and temperature readings are exposed and can be
> reset.
>
> The reported current and power depend on the external current-report
> resistor connected to the ILOAD pin, which can be provided through the
> "adi,rload-ohms" device tree property.
>
> On the MAX16550 and VT7505, the severe-OCP deglitch time can optionally
> be configured with the "adi,ocp-severe-filter-us" device tree property.
> When omitted, the existing hardware setting is left unchanged.
>
...
> +static void vt7505_set_m(int *m, u32 rload)
> +{
> + u64 val = (u64)*m * rload;
> +
> + /* Make sure m fits the s32 type */
> + *m = DIV_ROUND_CLOSEST_ULL(val, 1000);
The largest possible value of m is 7578. That means that this _will_
overflow if rload >= 283383960 because 283383960 * 7578 / 1000 =
2147483648.88, rounded up to to 2147483649 == 0x80000001.
Please add a range check in the probe function.
Thanks,
Guenter
next prev parent reply other threads:[~2026-07-24 17:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-24 16:49 [PATCH v3 0/2] hwmon: (pmbus) Add Analog Devices MAX16545/MAX16550 and Volterra VT7505 driver Pradhan, Sanman
2026-07-24 16:49 ` [PATCH v3 1/2] dt-bindings: hwmon: pmbus: Add Analog Devices MAX16545/MAX16550 and Volterra VT7505 Pradhan, Sanman
2026-07-24 16:50 ` [PATCH v3 2/2] hwmon: (pmbus/vt7505) Add driver for " Pradhan, Sanman
2026-07-24 17:27 ` Guenter Roeck [this message]
2026-07-24 17:53 ` Guenter Roeck
2026-07-24 19:42 ` Pradhan, Sanman
2026-07-24 21:25 ` Guenter Roeck
2026-07-24 19:59 ` Pradhan, Sanman
2026-07-24 21:26 ` Guenter Roeck
2026-07-25 21:21 ` Pradhan, Sanman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ff49ae92-cff8-489b-b702-9d8fb8dd4c69@roeck-us.net \
--to=linux@roeck-us.net \
--cc=avadhutn@juniper.net \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=ddevineni@juniper.net \
--cc=devicetree@vger.kernel.org \
--cc=dghosh@juniper.net \
--cc=gvlaev@juniper.net \
--cc=jawaharb@juniper.net \
--cc=krzk+dt@kernel.org \
--cc=krzk@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=makb@juniper.net \
--cc=psanman@juniper.net \
--cc=robh@kernel.org \
--cc=sanman.pradhan@hpe.com \
--cc=sbalraj@juniper.net \
--cc=skhan@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®