• Li Zefan's avatar
    HID: fix a potential bug in pointer casting · 3ba5619f
    Li Zefan authored
    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>
    3ba5619f
hid-tmff.c 5.69 KB