[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] x86_64/uaccess: address violations of MISRA C Rule 20.7
commit 1b0b050bd6713454aedec7c3c125c39f9c375bee Author: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx> AuthorDate: Tue May 21 16:00:47 2024 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Tue May 21 16:00:47 2024 +0200 x86_64/uaccess: address violations of MISRA C Rule 20.7 MISRA C Rule 20.7 states: "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses". Therefore, some macro definitions should gain additional parentheses to ensure that all current and future users will be safe with respect to expansions that can possibly alter the semantics of the passed-in macro parameter. xlat_malloc_init is touched for consistency, despite the construct being already deviated. No functional change. Signed-off-by: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx> Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx> Acked-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/arch/x86/include/asm/x86_64/uaccess.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/include/asm/x86_64/uaccess.h b/xen/arch/x86/include/asm/x86_64/uaccess.h index ba79f950fb..c6fa3fd381 100644 --- a/xen/arch/x86/include/asm/x86_64/uaccess.h +++ b/xen/arch/x86/include/asm/x86_64/uaccess.h @@ -26,15 +26,16 @@ void free_compat_arg_xlat(struct vcpu *v); #define xlat_page_start ((unsigned long)COMPAT_ARG_XLAT_VIRT_BASE) #define xlat_page_size COMPAT_ARG_XLAT_SIZE #define xlat_page_left_size(xlat_page_current) \ - (xlat_page_start + xlat_page_size - xlat_page_current) + (xlat_page_start + xlat_page_size - (xlat_page_current)) #define xlat_malloc_init(xlat_page_current) do { \ - xlat_page_current = xlat_page_start; \ + (xlat_page_current) = xlat_page_start; \ } while (0) extern void *xlat_malloc(unsigned long *xlat_page_current, size_t size); -#define xlat_malloc_array(_p, _t, _c) ((_t *) xlat_malloc(&_p, sizeof(_t) * _c)) +#define xlat_malloc_array(_p, _t, _c) ((_t *) xlat_malloc(&(_p), \ + sizeof(_t) * (_c))) /* * Valid if in +ve half of 48-bit address space, or above Xen-reserved area. -- generated by git-patchbot for /home/xen/git/xen.git#staging
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |