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]
Date:   Mon, 6 Mar 2017 15:47:55 -0800
From:   Guenter Roeck <linux@...ck-us.net>
To:     Peter Hüwe <PeterHuewe@....de>
Cc:     linux-hwmon@...r.kernel.org, Jean Delvare <jdelvare@...e.com>,
        linux-kernel@...r.kernel.org
Subject: Re: Question about hwmon_attr_show_string

On Mon, Mar 06, 2017 at 09:48:35PM +0100, Peter Hüwe wrote:
> Hi Guenter,
> 
> I was wondering whether there was a particular reason why 
> hwmon_attr_show_string passes only an "empty" pointer(pointer) to the ops-
> >read_string function rather than the buffer itself?
> 
> Wouldn't this mean that in ops->read_string I'd have to reserve some space for 
> the value on the heap (and taking care to free it somewhere, since returning 
> an address on the stack is bad idea), instead of calling sprintf(buf, "%s\n", 
> s) directly?
> 
> With the current implementation I have to sprintf it into my local buffer and 
> you sprintf it again into the final buffer.
> 
The idea was that the called code would return a pointer to a constant string,
ie one that isn't changing from call to call.

What attribute do you see that would require a dynamic (changing) string ?

Thanks,
Guenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ