[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 3/7] xen/elf: Fix MISRA C 2012 Rule 20.7 violations



On Fri, 19 Aug 2022, Xenia Ragiadakou wrote:
> In macros ELF32_ST_TYPE() and ELF64_ST_TYPE(), add parentheses around the
> macro parameter to prevent against unintended expansions.
> 
> Signed-off-by: Xenia Ragiadakou <burzalodowa@xxxxxxxxx>

Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>


> ---
>  xen/include/xen/elfstructs.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/include/xen/elfstructs.h b/xen/include/xen/elfstructs.h
> index 616ebf9269..0a7c558a80 100644
> --- a/xen/include/xen/elfstructs.h
> +++ b/xen/include/xen/elfstructs.h
> @@ -305,11 +305,11 @@ typedef struct {
>  
>  /* Extract symbol info - st_info */
>  #define ELF32_ST_BIND(x)     ((x) >> 4)
> -#define ELF32_ST_TYPE(x)     (((unsigned int) x) & 0xf)
> +#define ELF32_ST_TYPE(x)     (((unsigned int) (x)) & 0xf)
>  #define ELF32_ST_INFO(b,t)   (((b) << 4) + ((t) & 0xf))
>  
>  #define ELF64_ST_BIND(x)     ((x) >> 4)
> -#define ELF64_ST_TYPE(x)     (((unsigned int) x) & 0xf)
> +#define ELF64_ST_TYPE(x)     (((unsigned int) (x)) & 0xf)
>  #define ELF64_ST_INFO(b,t)   (((b) << 4) + ((t) & 0xf))
>  
>  /* Symbol Binding - ELF32_ST_BIND - st_info */
> -- 
> 2.34.1
> 



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.