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] [day] [month] [year] [list]
Message-ID: <b3dde971-eed4-4e7f-bb3b-6a761de65009@intel.com>
Date: Fri, 11 Oct 2024 09:25:17 +0200
From: Przemek Kitszel <przemyslaw.kitszel@...el.com>
To: David Lechner <dlechner@...libre.com>, Peter Zijlstra
	<peterz@...radead.org>
CC: <amadeuszx.slawinski@...ux.intel.com>, Tony Nguyen
	<anthony.l.nguyen@...el.com>, <nex.sw.ncis.osdt.itp.upstreaming@...el.com>,
	<linux-kernel@...r.kernel.org>, <netdev@...r.kernel.org>, Markus Elfring
	<Markus.Elfring@....de>, Dan Carpenter <dan.carpenter@...aro.org>, "Andy
 Shevchenko" <andriy.shevchenko@...el.com>, Dmitry Torokhov
	<dmitry.torokhov@...il.com>
Subject: Re: [PATCH v2] cleanup: adjust scoped_guard() to avoid potential
 warning

On 10/10/24 22:13, David Lechner wrote:
> On 10/9/24 6:44 AM, Przemek Kitszel wrote:
>> Change scoped_guard() to make reasoning about it easier for static
>> analysis tools (smatch, compiler diagnostics), especially to enable them
>> to tell if the given scoped_guard() is conditional (interruptible-locks,
>> try-locks) or not (like simple mutex_lock()).
>>
>> Add compile-time error if scoped_cond_guard() is used for non-conditional
>> lock class.
>>
>> Beyond easier tooling and a little shrink reported by bloat-o-meter:
>> add/remove: 3/2 grow/shrink: 45/55 up/down: 1573/-2069 (-496)
>> this patch enables developer to write code like:
>>
>> int foo(struct my_drv *adapter)
>> {
>> 	scoped_guard(spinlock, &adapter->some_spinlock)
>> 		return adapter->spinlock_protected_var;
>> }
>>>
>> Current scoped_guard() implementation does not support that,
>> due to compiler complaining:
>> error: control reaches end of non-void function [-Werror=return-type]
> 
> I was hoping that this would allow us to do the same with
> scoped_cond_guard() so that we could remove a bunch of
> unreachable(); that we had to add in the IIO subsystem. But
> with this patch we still get compile errors if we remove them.
> 
> Is it possible to apply the same if/goto magic to scoped_cond_guard()
> to make it better too?
sure, will do

I will also combine both macros __helper at the same time to reduce
duplication

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ