lkml.org 
[lkml]   [2022]   [Sep]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 20/21] hwmon: (mr75203) add debugfs to read and write temperature coefficients
On Tue, Sep 13, 2022 at 05:40:16PM +0300, Farber, Eliav wrote:
> On 9/13/2022 4:06 PM, Farber, Eliav wrote:

...

> It seems like debugfs_attr_write() calls simple_attr_write() and it uses
> kstrtoull(), which is why it fails when setting a negative value.
> This is the same also in v6.0-rc5.
>
> debugfs_attr_read() on the other hand does show the correct value also
> when j is negative.

Which puzzles me since there is a few drivers that use %lld.
Yeah, changing it to

ret = sscanf(attr->set_buf, attr->fmt, &val);
if (ret != 1)
ret = -EINVAL;

probably can fix that. Dunno if debugfs maintainer is okay with this.

P.S. This needs revisiting all format strings to see if there are no additional
characters, otherwise that needs to be addressed first, if feasible.

--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2022-09-13 20:03    [W:0.096 / U:0.948 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site