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: <21be0ed9-7b72-42fb-a2fb-b655a7ebc072@web.de>
Date: Mon, 30 Sep 2024 13:30:16 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: Przemek Kitszel <przemyslaw.kitszel@...el.com>,
 kernel-janitors@...r.kernel.org, Peter Zijlstra <peterz@...radead.org>
Cc: LKML <linux-kernel@...r.kernel.org>, netdev@...r.kernel.org,
 nex.sw.ncis.osdt.itp.upstreaming@...el.com,
 Amadeusz Sławiński
 <amadeuszx.slawinski@...ux.intel.com>,
 Andy Shevchenko <andriy.shevchenko@...el.com>,
 Simon Horman <horms@...nel.org>, Tony Nguyen <anthony.l.nguyen@...el.com>
Subject: Re: [RFC PATCH] cleanup: make scoped_guard() to be return-friendly

…
> Current scoped_guard() implementation does not support that,
> due to compiler complaining:
…
> +++ b/include/linux/cleanup.h
> @@ -168,9 +168,16 @@ static inline class_##_name##_t class_##_name##ext##_constructor(_init_args) \
>
>  #define __guard_ptr(_name) class_##_name##_lock_ptr
>
> -#define scoped_guard(_name, args...)					\
> -	for (CLASS(_name, scope)(args),					\
> -	     *done = NULL; __guard_ptr(_name)(&scope) && !done; done = (void *)1)
> +#define scoped_guard(_name, args...)	\
> +	__scoped_guard_labeled(__UNIQUE_ID(label), _name, args)
> +
> +#define __scoped_guard_labeled(_label, _name, args...)	\
> +	if (0)						\
> +		_label: ;				\
> +	else						\
> +		for (CLASS(_name, scope)(args);		\
> +		     __guard_ptr(_name)(&scope), 1;	\
> +		     ({ goto _label; }))
>
>  #define scoped_cond_guard(_name, _fail, args...) \
>  	for (CLASS(_name, scope)(args), \

* How do you think about to define such macros before their use?

* Would you ever like to avoid reserved identifiers in such source code?
  https://wiki.sei.cmu.edu/confluence/display/c/DCL37-C.+Do+not+declare+or+define+a+reserved+identifier


Regards,
Markus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ