summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérémy Dufour2012-11-12 17:15:06 +0100
committerJérémy Dufour2012-11-21 17:09:39 +0100
commit6f3c76922477ba9c4d2494857625c748c42308d0 (patch)
tree7fa56108c276fe5ffbad4175305d1611e4bc5228
parente2465d55002d17784585a230ec04ffc02a2f08ad (diff)
common/include: add a sanity check for size of spid image desc, refs #3452
All spidcom image descriptors must have the same size, we should ensure this is always respected.
-rw-r--r--common/include/asm/arch/spid_img_desc.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/common/include/asm/arch/spid_img_desc.h b/common/include/asm/arch/spid_img_desc.h
index cf2f86df9a..cc2b158fd7 100644
--- a/common/include/asm/arch/spid_img_desc.h
+++ b/common/include/asm/arch/spid_img_desc.h
@@ -115,4 +115,21 @@ typedef spidcom_image_desc_200_t spidcom_image_desc_t;
typedef spidcom_image_desc_300_t spidcom_image_desc_t;
#endif
+/**
+ * If structures spidcom_image_desc_{2,3}00_t have different sizeof, this have
+ * a negative value, otherwise it will be 1.
+ */
+#define error_size (1 - 2 \
+ * (sizeof (spidcom_image_desc_200_t) \
+ != sizeof (spidcom_image_desc_300_t)))
+/**
+ * This typedef is used to produce an error if error_size is negative.
+ * If you have an error while building (i.e.: array size is negative), this
+ * mean structures spidcom_image_desc_{2,3}00_t have different size. You need
+ * to fix it!
+ */
+typedef char all_spidcom_images_desc_must_have_the_same_size[error_size];
+
+#undef error_size
+
#endif /* __ASM_ARCH_SPID_IMG_DESC_H */