container_of

Mike Krinkin krinkin.m.u at gmail.com
Sat Jan 17 14:53:10 EST 2015


Hi, Simon

> I compiled the kernel two times, one time with the original code and
> one time with
> #define container_of(ptr, type, member) ({			\
> 	(type *)( (char *)ptr - offsetof(type,member) );})

try with following version:

#define container_of(ptr, type, member) ({ \
	(type *)((char *)(ptr) - offsetof(type, member));})



More information about the Kernelnewbies mailing list