From: Jan Kara Date: Tue, 12 Nov 2013 23:11:19 +0000 (-0800) Subject: rbtree: fix rbtree_postorder_for_each_entry_safe() iterator X-Git-Tag: v3.13-rc1~106^2~21 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1310a5a99d900ee30b9f171146406bde0c6c2bd4;p=pandora-kernel.git rbtree: fix rbtree_postorder_for_each_entry_safe() iterator The iterator rbtree_postorder_for_each_entry_safe() relies on pointer underflow behavior when testing for loop termination. In particular it expects that &rb_entry(NULL, type, field)->field is NULL. But the result of this expression is not defined by a C standard and some gcc versions (e.g. 4.3.4) assume the above expression can never be equal to NULL. The net result is an oops because the iteration is not properly terminated. Fix the problem by modifying the iterator to avoid pointer underflows. Signed-off-by: Jan Kara Signed-off-by: Cody P Schafer Cc: Michel Lespinasse Cc: "David S. Miller" Cc: Adrian Hunter Cc: Artem Bityutskiy Cc: David Woodhouse Cc: Jozsef Kadlecsik Cc: Pablo Neira Ayuso Cc: Patrick McHardy Cc: Paul Mundt Cc: Theodore Ts'o Cc: [3.12.x] Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Reading git-diff-tree failed