Bug#369779: strict aliasing bug in mdadm

Neil Brown neilb at suse.de
Fri Jun 2 02:10:54 UTC 2006


On Thursday June 1, madduck at debian.org wrote:
> tags 369779 + confirmed upstream pending
> thanks
> 
> I can confirm this bug. For now, it surely suffices to add
> -fno-strict-aliasing in Debian if you, Neil, still use the flag for
> development.
> 
> I am surely not touching dlink.h, even though that seems to be the
> source of the problem. Maybe this could be fixed sometime in the
> future? Maybe there's even another implementation out there?

I already received a patch to fix this problem.  It will be in 2.5.1

NeilBrown

From: Luca Berra <bluca at vodka.it>

diff ./dlink.h~current~ ./dlink.h
--- ./dlink.h~current~	2005-12-05 16:52:22.000000000 +1100
+++ ./dlink.h	2006-05-29 11:46:19.000000000 +1000
@@ -4,16 +4,16 @@
 
 struct __dl_head
 {
-    struct __dl_head *	dh_prev;
-    struct __dl_head *	dh_next;
+    void * dh_prev;
+    void * dh_next;
 };
 
 #define	dl_alloc(size)	((void*)(((char*)calloc(1,(size)+sizeof(struct __dl_head)))+sizeof(struct __dl_head)))
 #define	dl_new(t)	((t*)dl_alloc(sizeof(t)))
 #define	dl_newv(t,n)	((t*)dl_alloc(sizeof(t)*n))
 
-#define dl_next(p) *((void**)&(((struct __dl_head*)(p))[-1].dh_next))
-#define dl_prev(p) *((void**)&(((struct __dl_head*)(p))[-1].dh_prev))
+#define dl_next(p) *(&(((struct __dl_head*)(p))[-1].dh_next))
+#define dl_prev(p) *(&(((struct __dl_head*)(p))[-1].dh_prev))
 
 void *dl_head(void);
 char *dl_strdup(char *);





More information about the pkg-mdadm-devel mailing list