Skip to contentSkip to conversation

struct check

PATCH New Jean Tourrilhes 1 participant 1 message Jul 10, 2003 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 struct check

ir250_struct_check.diff :
~~~~~~~~~~~~~~~~~~~~~~~
<Suggested by Russell King>
o [FEATURE] Add struct size check for buggy compilers

net/irda/irlap.c renamed from net/irda/irlap.d2.c +7 -0
diff -u -p linux/net/irda/irlap.d2.c linux/net/irda/irlap.c
@@ -79,6 +79,13 @@ int irlap_proc_read(char *, char **, off
 
 int __init irlap_init(void)
 {
+	/* Check if the compiler did its job properly.
+	 * May happen on some ARM configuration, check with Russell King. */
+	ASSERT(sizeof(struct xid_frame) == 14, ;);
+	ASSERT(sizeof(struct test_frame) == 10, ;);
+	ASSERT(sizeof(struct ua_frame) == 10, ;);
+	ASSERT(sizeof(struct snrm_frame) == 11, ;);
+
 	/* Allocate master array */
 	irlap = hashbin_new(HB_LOCK);
 	if (irlap == NULL) {