Skip to content

Commit 620f33d

Browse files
radaretrufae
authored andcommitted
Fix UB cast in container_of macro ##crash
1 parent e5ff6a6 commit 620f33d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libr/include/r_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ static inline void r_run_call10(void *fcn, void *arg1, void *arg2, void *arg3, v
750750
}
751751

752752
#ifndef container_of
753-
#define container_of(ptr, type, member) (ptr? ((type *)((char *)(ptr) - r_offsetof(type, member))): NULL)
753+
#define container_of(ptr, type, member) ((ptr)? ((type *)(void *)((char *)(ptr) - r_offsetof(type, member))): NULL)
754754
#endif
755755

756756
#endif // R2_TYPES_H

0 commit comments

Comments
 (0)