Similarly to @chux's answer, I'm used to do something like this ;
#define MAX_SZ 10485760UL
#define BLOCK_SZ 64UL
#define DP_BUF_RSV_SIZE (256 * 16 * BLOCK_SZ)
#define DP_BUF_UL_SIZE (3072 * 16 * BLOCK_SZ)
#define DP_BUF_DL_SIZE (4096 * 16 * BLOCK_SZ)
#define DP_BUF_COMMON_SIZE (2048 * 16 * BLOCK_SZ)
#if ((DP_BUF_RSV_SIZE + DP_BUF_UL_SIZE + DP_BUF_DL_SIZE + DP_BUF_COMMON_SIZE) > MAX_SZ)
#error Too large
// Eventually
#elif ((DP_BUF_RSV_SIZE + DP_BUF_UL_SIZE + DP_BUF_DL_SIZE + DP_BUF_COMMON_SIZE) % BLOCK_SZ)
#error Not multiple of 64
#endif
So the program wouldn't compile if DP_BUF_RSV_SIZE + DP_BUF_UL_SIZE + DP_BUF_DL_SIZE + DP_BUF_COMMON_SIZE
is superior to MAX_SZ
, or if it ain't a multiple of 64.