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 <burzalod...@gmail.com>

Reviewed-by: Stefano Stabellini <sstabell...@kernel.org>


> ---
>  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
> 

Reply via email to