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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ecb33c61-bb40-43a0-94a1-8973d70dc0b4@linaro.org>
Date: Mon, 15 Jan 2024 17:55:02 +0100
From: Daniel Lezcano <daniel.lezcano@...aro.org>
To: "Rafael J. Wysocki" <rafael@...nel.org>, Minjie Du <duminjie@...o.com>
Cc: Zhang Rui <rui.zhang@...el.com>, Lukasz Luba <lukasz.luba@....com>,
 "open list:THERMAL" <linux-pm@...r.kernel.org>,
 open list <linux-kernel@...r.kernel.org>, opensource.kernel@...o.com
Subject: Re: [PATCH v1] thermal/debugfs: Remove unnecessary
 debugfs_create_dir() error check in thermal_debug_init()

On 15/01/2024 16:52, Rafael J. Wysocki wrote:
> On Mon, Jan 15, 2024 at 9:25 AM Minjie Du <duminjie@...o.com> wrote:
>>
>> This patch removes the debugfs_create_dir() error checking in
>> thermal_debug_init(). Because the debugfs_create_dir() is developed
>> in a way that the caller can safely handle the errors that
>> occur during the creation of DebugFS nodes.
> 
> I honestly don't see what the purpose of this patch is.

I think it is because the recent debugfs changes were about to reduce as 
much as possible the code related to the error handling as the debugfs 
is not supposed to go in production system.

So for instance debugfs_create_dir() will not fail if the parent is NULL 
and will create the entry in the debugfs topdir.

At the end we are ending up with:

d_root = debugfs_create_dir("thermal", NULL);
d_cdev = debugfs_create_dir("cooling_devices", d_root);
d_tz = debugfs_create_dir("thermal_zones", d_root);

The current code will avoid creating lost entries in /sys/kernel/debug

The proposed change will create those in /sys/kernel/debug in case of error.

Note I reduced as much as possible the error handling in this function. 
So it is a matter to reduce it even more but may be resulting in junk in 
/sys/kernel/debug in case of error

TBH, I'm 50/50  :)

>> Signed-off-by: Minjie Du <duminjie@...o.com>
>> ---
>>   drivers/thermal/thermal_debugfs.c | 4 ----
>>   1 file changed, 4 deletions(-)
>>
>> diff --git a/drivers/thermal/thermal_debugfs.c b/drivers/thermal/thermal_debugfs.c
>> index a3fa09235da1..695253559a61 100644
>> --- a/drivers/thermal/thermal_debugfs.c
>> +++ b/drivers/thermal/thermal_debugfs.c
>> @@ -172,12 +172,8 @@ struct thermal_debugfs {
>>   void thermal_debug_init(void)
>>   {
>>          d_root = debugfs_create_dir("thermal", NULL);
>> -       if (!d_root)
>> -               return;
>>
>>          d_cdev = debugfs_create_dir("cooling_devices", d_root);
>> -       if (!d_cdev)
>> -               return;
>>
>>          d_tz = debugfs_create_dir("thermal_zones", d_root);
>>   }
>> --

-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ