Re: [PATCH v2 0/2] Lock and Pointer guards

From: Kees Cook
Date: Tue Jun 06 2023 - 11:32:03 EST


On Tue, Jun 06, 2023 at 11:42:51AM +0200, Peter Zijlstra wrote:
> [...]
> #define scoped_guard(_guard, _var...) \
> for (__ptr_guard(_guard, scope) = guard_init(_guard, _var), \
> *done = NULL; !done; done = (void *)1)

nit: Linus's example was "(void *)8" (instead of 1) because we've had
issues in the past with alignment warnings on archs that are sensitive
to it. (e.g. see the __is_constexpr() macro which is doing NULL/!NULL
comparisons.)

--
Kees Cook