drm: Branch 'master'

[email protected] (Rob Clark)
Newsgroups gmane.comp.video.dri.patches
Message-ID <[email protected]>
 util_double_list.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b214b05ccd433c484a6a65e491a1a51b19e4811d
Author: Rob Clark <[email protected]>
Date:   Tue Aug 2 16:16:02 2016 -0400

    list: fix an issue with android build using clang
    
    Sorry, I don't understand the android build system enough to say *which*
    version of clang this effects, but either "clang-2812033" or
    "clang-3016494" (probably the later).
    
    But when 'sample' is undefined (ie. unitialized variable), the result is
    not as well defined as it is with gcc.  Instead use a typeof() cast with
    a defined value (ie. zero).
    
    This fixes a crash that was reported on android.
    
    Reported-by: John Stultz <[email protected]>
    Signed-off-by: Rob Clark <[email protected]>

diff --git a/util_double_list.h b/util_double_list.h
index 5d01f52..7e48b26 100644
--- a/util_double_list.h
+++ b/util_double_list.h
@@ -110,7 +110,7 @@ static inline void list_delinit(struct list_head *item)
 #ifndef container_of
 #define container_of(ptr, sample, member)				\
     (void *)((char *)(ptr)						\
-	     - ((char *)&(sample)->member - (char *)(sample)))
+	     - ((char *)&((typeof(sample))0)->member))
 #endif
 
 #define LIST_FOR_EACH_ENTRY(pos, head, member)				\

------------------------------------------------------------------------------
--
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.