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: <09b130f2-740d-4e16-aaa2-8802d9c28277@hartkopp.net>
Date: Wed, 30 Oct 2024 16:01:29 +0100
From: Oliver Hartkopp <socketcan@...tkopp.net>
To: Nam Cao <namcao@...utronix.de>
Cc: Anna-Maria Behnsen <anna-maria@...utronix.de>,
 Frederic Weisbecker <frederic@...nel.org>,
 Thomas Gleixner <tglx@...utronix.de>,
 Andreas Hindborg <a.hindborg@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>,
 Miguel Ojeda <ojeda@...nel.org>, Kees Cook <kees@...nel.org>,
 linux-kernel@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>
Subject: Re: [PATCH 05/21] can: bcm: Don't initialized an unused hrtimer

Just an additional idea:

Would it probably make sense to create a generic dummy function for all 
those cases like in the referenced rt2x00 driver?

E.g. as (inline?) function in hrtimer.h

enum hrtimer_restart hrtimer_nop_callback(struct hrtimer *timer)
{
	return HRTIMER_NORESTART;
}

??

Best regards,
Oliver

On 30.10.24 15:51, Oliver Hartkopp wrote:
> 
> 
> On 30.10.24 13:15, Nam Cao wrote:
>> On Wed, Oct 30, 2024 at 11:49:49AM +0100, Oliver Hartkopp wrote:
>>> On 28.10.24 08:29, Nam Cao wrote:
>>>> The hrtimer "thrtimer" is not used for TX. But this timer is 
>>>> initialized
>>>> regardless.
>>>>
>>>> Remove the hrtimer_init() for the unused hrtimer and change 
>>>> bcm_remove_op()
>>>> to make sure hrtimer_cancel() is not called with the uninitialized 
>>>> hrtimer.
>>>
>>> NAK.
>>>
>>> There are several other occurrences of thrtimer that are not covered by
>>> RX/TX distinction, where the second timer is canceled.
>>>
>>> This one-time init and cancel of an unused hrtimer costs nearly 
>>> nothing and
>>> is not even in any hot path.
>>>
>>> So this incomplete patch only adds complexity and potential error 
>>> cases in
>>> some 20 y/o code for nothing.
>>
>> The "real" motivation is preparing to use hrtimer_setup() instead of
>> hrtimer_init() [1] and deleting hrtimer_init() [2]. The new function
>> mandates a callback function, and since the TX thrtimer doesn't have a
>> callback function, hrtimer_setup() cannot be used.
>>
>> Your concerns are also valid. So I can drop this patch, and use a dummy
>> function to make hrtimer_setup() happy, like how it's done for the rt2x00
>> driver [3]. It will make the driver a bit ugly, but it's obvious that it
>> won't cause any regression.
> 
> Many thanks for your efforts!
> That's a good approach!
> 
> Best regards,
> Oliver
> 
>>
>> Best regards,
>> Nam
>>
>> [1] https://lore.kernel.org/lkml/ 
>> e4ce3a3a28625d54ef93e47bfb02f7ffb741758a.1729865232.git.namcao@...utronix.de/
>> [2] https://lore.kernel.org/ 
>> lkml/7bde2762d82d30dab184c7a747e76afc41208da0.1729865740.git.namcao@...utronix.de/
>> [3] https://lore.kernel.org/ 
>> lkml/49f2bce487f56eb2a3ff572ea6d7de0a43560c0f.1729865232.git.namcao@...utronix.de/
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ