MISRA C Rule 20.7 states: "Expressions resulting from the expansion
of macro parameters shall be enclosed in parentheses". Therefore, some
macro definitions should gain additional parentheses to ensure that all
current and future users will be safe with respect to expansions that
can possibly alter the semantics of the passed-in macro parameter.
No functional change.
Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
#include <public/hvm/e820.h>
/* Get page attribute fields (PAn) from PAT MSR. */
-#define pat_cr_2_paf(pat_cr,n) ((((uint64_t)pat_cr) >> ((n)<<3)) & 0xff)
+#define pat_cr_2_paf(pat_cr, n) (((uint64_t)(pat_cr) >> ((n) << 3)) & 0xff)
/* Effective mm type lookup table, according to MTRR and PAT. */
static const uint8_t mm_type_tbl[MTRR_NUM_TYPES][X86_NUM_MT] = {
#define vrtc_domain(x) (container_of(x, struct pl_time, vrtc)->domain)
#define vrtc_vcpu(x) (pt_global_vcpu_target(vrtc_domain(x)))
#define epoch_year 1900
-#define get_year(x) (x + epoch_year)
+#define get_year(x) ((x) + epoch_year)
enum rtc_mode {
rtc_mode_no_ack,
HVM_SAVE_LENGTH(x), true) == 0 ) \
{ \
ptr = &(h)->data[(h)->cur]; \
- h->cur += HVM_SAVE_LENGTH(x); \
+ (h)->cur += HVM_SAVE_LENGTH(x); \
} \
ptr; })