Prevent any operator prioritization issues when embedding ARRAY_SIZE
into an expression by protecting the result with braces. This is a
defensive measure, no current user was affected by it.
Do not convert all the generated or copy&pasted ARRAY_SIZE defines in
the config files as long as they are not affected by the issue.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
* the COPYING file in the top-level directory.
*/
-#define ARRAY_SIZE(array) sizeof(array) / sizeof((array)[0])
+#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
/* create 64-bit mask with bytes 0 to size-1 set to 0xff */
#define BYTE_MASK(size) (0xffffffffffffffffULL >> ((8 - (size)) * 8))
#include <linux/types.h>
#include <jailhouse/cell-config.h>
-#define ARRAY_SIZE(a) sizeof(a) / sizeof(a[0])
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
struct {
struct jailhouse_system header;