From: Li Zefan Date: Wed, 14 Nov 2007 10:31:05 +0000 (+0100) Subject: HID: fix a potential bug in pointer casting X-Git-Tag: v2.6.25-rc1~1170^2~19 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ba5619f06300cd0944150901ed20de87483ad8c;p=pandora-kernel.git HID: fix a potential bug in pointer casting Don't directly cast list_head * to foo *, this works only when list is the first member of struct foo, and we should not make the assumption how members are ordered in the structure. i.e. struct *f = (struct *f)pos will work if: struct foo { struct list_head list; int i; }; but will fail if: struct foo { int i; struct list_head list; } Signed-off-by: Li Zefan Signed-off-by: Jiri Kosina --- Reading git-diff-tree failed