Skip to content

Commit eded27a

Browse files
author
Jyri Sarha
committed
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 <jyri.sarha@linux.intel.com>
1 parent afbcb12 commit eded27a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/include/sof/common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
/* Align the number to the nearest alignment value */
2222
#ifndef IS_ALIGNED
23-
#define IS_ALIGNED(size, alignment) ((size) % (alignment) == 0)
23+
#define IS_ALIGNED(size, alignment) (!(alignment) || (size) % (alignment) == 0)
2424
#endif
2525

2626
/* Treat zero as a special case because it wraps around */

0 commit comments

Comments
 (0)