Skip to content
Commit 3ba5619f authored by Li Zefan's avatar Li Zefan Committed by Jiri Kosina
Browse files

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: default avatarLi Zefan <lizf@cn.fujitsu.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent c80e5ffa
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment