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: <cd6eb645-4663-40a6-c238-7c82123db1a4@gmail.com>
Date:   Tue, 25 Oct 2022 10:06:51 +0300
From:   Matti Vaittinen <mazziesaccount@...il.com>
To:     Sakari Ailus <sakari.ailus@...ux.intel.com>
Cc:     Matti Vaittinen <matti.vaittinen@...rohmeurope.com>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Daniel Scally <djrscally@...il.com>,
        Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Wolfram Sang <wsa@...nel.org>,
        Akhil R <akhilrajeev@...dia.com>, linux-acpi@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drivers: fwnode: fix fwnode_irq_get_byname() kerneldoc

Hi Sakari,

On 10/25/22 09:48, Sakari Ailus wrote:
> Moi,
> 
> On Tue, Oct 25, 2022 at 08:24:24AM +0300, Matti Vaittinen wrote:
>> The fwnode_irq_get_byname() may return zero on device-tree mapping
>> error. Fix documentation to reflect this as current documentation
>> suggests check:
>>
>> if (ret < 0)
>> is enough to detect the errors. This is not the case.
>>
>> Add zero as a return value indicating error.
>>
>> Fixes: ca0acb511c21 ("device property: Add fwnode_irq_get_byname")
>> Suggested-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
>> Signed-off-by: Matti Vaittinen <mazziesaccount@...il.com>
>> ---
>>   drivers/base/property.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/base/property.c b/drivers/base/property.c
>> index 4d6278a84868..df437d10aa08 100644
>> --- a/drivers/base/property.c
>> +++ b/drivers/base/property.c
>> @@ -960,7 +960,7 @@ EXPORT_SYMBOL(fwnode_irq_get);
>>    * string.
>>    *
>>    * Return:
>> - * Linux IRQ number on success, or negative errno otherwise.
>> + * Linux IRQ number on success, zero or negative errno otherwise.
> 
> I wonder if it would be possible instead to always return a negative error
> code on error. Returning zero on error is really unconventional and can be
> expected to be a source of bugs.

Agree, and I did also consider just adding:

if (!ret)
	return -EINVAL; (or another feasible errno)

return ret;

at the end of the fwnode_irq_get_byname().

However, such a functional change would require auditing the existing 
callers which I have no time right now.
if (someone is up to the task)
	be my guest :)
else
	please fix the doc ;)

Yours
	-- Matti

-- 
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ