|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH for-4.14 3/3] xen/x86: atomic: Don't allow to write atomically in a pointer to const
On 02.05.2020 18:07, Julien Grall wrote:
> From: Julien Grall <jgrall@xxxxxxxxxx>
>
> At the moment, write_atomic() will happily write to a pointer to const.
> While there are no use in Xen, it would be best to catch them at
> compilation time.
>
> Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx>
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
albeit ...
> --- a/xen/include/asm-x86/atomic.h
> +++ b/xen/include/asm-x86/atomic.h
> @@ -63,6 +63,8 @@ void __bad_atomic_size(void);
>
> #define write_atomic(p, x) ({ \
> typeof(*(p)) __x = (x); \
> + /* Check that the pointer is not const */ \
> + void *__maybe_unused p_ = &__x; \
... along the lines of the similar case with guest handles I'd
like to suggest for the comment to be more precise: It's not
the pointer's const-ness you're after, but the pointed to
object's. Maybe "Check that the pointer is not to a const
type" or even just "Check that the pointer is not to const"?
Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |