From 10018efdb90d4067c69941eb2df300a0afb75439 Mon Sep 17 00:00:00 2001 From: Jyri Sarha Date: Wed, 22 Oct 2025 18:23:27 +0300 Subject: [PATCH] common.h: Make IS_ALIGNED() safe for testing with alignment == 0 Make IS_ALIGNED() safe for testing with alignment == 0. Without this fix the DSP will crash if alignemnet is 0. Signed-off-by: Jyri Sarha --- src/include/sof/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/include/sof/common.h b/src/include/sof/common.h index 4bb279b039aa..8c81d3b091a8 100644 --- a/src/include/sof/common.h +++ b/src/include/sof/common.h @@ -20,7 +20,7 @@ /* Align the number to the nearest alignment value */ #ifndef IS_ALIGNED -#define IS_ALIGNED(size, alignment) ((size) % (alignment) == 0) +#define IS_ALIGNED(size, alignment) (!(alignment) || (size) % (alignment) == 0) #endif /* Treat zero as a special case because it wraps around */