On Fri, Dec 04, 2020 at 10:43:31AM -0600, Glenn Washburn wrote:
> This ensures that expected order of operations is preserved when arguments
> are expressions.
> 
> Signed-off-by: Glenn Washburn <developm...@efficientek.com>

Reviewed-by: Patrick Steinhardt <p...@pks.im>

> ---
>  include/grub/misc.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/grub/misc.h b/include/grub/misc.h
> index b7ca6dd58..780a34e90 100644
> --- a/include/grub/misc.h
> +++ b/include/grub/misc.h
> @@ -28,10 +28,10 @@
>  #include <grub/compiler.h>
>  
>  #define ALIGN_UP(addr, align) \
> -     ((addr + (typeof (addr)) align - 1) & ~((typeof (addr)) align - 1))
> +     (((addr) + (typeof (addr)) (align) - 1) & ~((typeof (addr)) (align) - 
> 1))
>  #define ALIGN_UP_OVERHEAD(addr, align) ((-(addr)) & ((typeof (addr)) (align) 
> - 1))
>  #define ALIGN_DOWN(addr, align) \
> -     ((addr) & ~((typeof (addr)) align - 1))
> +     ((addr) & ~((typeof (addr)) (align) - 1))
>  #define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0]))
>  #define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; }
>  
> -- 
> 2.27.0
> 

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to