lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAfUjZF7jOoZz5h6XkxqOyt=x8xnv+SUbMWJ1bVdxUzFRTO8cA@mail.gmail.com>
Date: Tue, 14 Jan 2025 16:02:20 +0800
From: Leo Yang <leo.yang.sy0@...il.com>
To: Guenter Roeck <linux@...ck-us.net>
Cc: jdelvare@...e.com, robh@...nel.org, davem@...emloft.net, 
	krzk+dt@...nel.org, conor+dt@...nel.org, Leo-Yang@...ntatw.com, 
	corbet@....net, Delphine_CC_Chiu@...ynn.com, linux-hwmon@...r.kernel.org, 
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org, 
	linux-doc@...r.kernel.org, kernel test robot <lkp@...el.com>
Subject: Re: [PATCH v2 2/2] hwmon: Add driver for TI INA232 Current and Power Monitor

Hi Guenter,

On Sat, Jan 11, 2025 at 12:22 AM Guenter Roeck <linux@...ck-us.net> wrote:
>
> > +
> > +     /* If INA233 skips current/power, shunt-resistor and current-lsb aren't needed. */
> > +     /* read rshunt value (uOhm) */
> > +     if (of_property_read_u32(client->dev.of_node, "shunt-resistor", &rshunt) < 0)
> > +             rshunt = INA233_RSHUNT_DEFAULT;
> > +
> > +     /* read current_lsb value (uA) */
> > +     if (of_property_read_u16(client->dev.of_node, "ti,current-lsb", &current_lsb) < 0)
> > +             current_lsb = INA233_CURRENT_LSB_DEFAULT;
> > +
> of_property_read_u16() returns -EOVERFLOW if the value provided was too large.
> This should be checked to avoid situations where the value provided in devicetree
> is too large.
>
Sorry I have a question, I can't get it to return -EOVERFLOW when I test it
I am using the following properties:
test16 = /bits/ 16 <0xfffd>;
of_property_read_u16 reads 0xfffd

test16o = /bits/ 16 <0xfffdd>;
of_property_read_u16 reads 0xffdd

test16o = <0xfffdd>;
of_property_read_u16 reads 0xf

test16array = /bits/ 16 <0xfffd 0xfffe>;
of_property_read_u16 reads 0xfffd

The same result for device_property_read_u16, it seems that a data
truncation occurs and none of them return -EOVERFLOW.

So maybe there is no need to check EOVERFLOW?
Or maybe we could use the minimum and maximum of the binding to
indicate the range.


Best Regards,

Leo Yang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ