]> git.ipfire.org Git - thirdparty/util-linux.git/commit
include/list: fix undefined behavior in list_entry() macro
authorSami Liedes <sami.liedes@iki.fi>
Mon, 17 Dec 2012 15:22:35 +0000 (16:22 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 17 Dec 2012 15:23:35 +0000 (16:23 +0100)
commitbecd09500f4abe1c11edb42289f4f6b453b01c65
tree677a06c6fb0380d563bd11225670a49e985f883c
parent7cdfc45f99c04797aa0838310dae4e7bf95f6c9d
include/list: fix undefined behavior in list_entry() macro

Update list_entry() macro, which is basically the same as the
container_of() macro in the kernel, to use offsetof() to fix undefined
behavior.

Caught using clang -fsanitize=undefined.

[kzak@redhat.com: port from e2fsprogs]

Signed-off-by: Sami Liedes <sami.liedes@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
include/list.h