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:	Tue, 13 Oct 2015 22:38:12 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Arnd Bergmann <arnd@...db.de>
Cc:	Ingo Molnar <mingo@...nel.org>, linux-kernel@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org,
	Mark Brown <broonie@...nel.org>,
	Liam Girdwood <lgirdwood@...il.com>, akpm@...ux-foundation.org
Subject: Re: [PATCH] mutex: make mutex_lock_nested an inline function

On Tue, Oct 13, 2015 at 10:30:08PM +0200, Arnd Bergmann wrote:
> The second argument of the mutex_lock_nested() helper is only
> evaluated if CONFIG_DEBUG_LOCK_ALLOC is set. Otherwise we
> get this build warning for the new regulator_lock_supply
> function:
> 
> drivers/regulator/core.c: In function 'regulator_lock_supply':
> drivers/regulator/core.c:142:6: warning: unused variable 'i' [-Wunused-variable]
> 
> To avoid the warning, this patch changes the definition of
> mutex_lock_nested() to be static inline function rather than
> a macro, which tells gcc that the variable is potentially
> used.

> -# define mutex_lock_nested(lock, subclass) mutex_lock(lock)
> +static inline void mutex_lock_nested(struct mutex *lock, unsigned int subclass)
> +{
> +	return mutex_lock(lock);
> +}

Can you verify that this results in an identical kernel?

Having this a proper argument results in the compiler having to actually
evaluate the expression resulting in @subclass, this might have side
effects and generate code.

A quick grep shows a large amount of trivial code that optimizers will
still happily throw away, but it should be verified that this does not
result in pointless code generation.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ