From ec685509a6f71e46e820a2cfa682fab80e66e874 Mon Sep 17 00:00:00 2001 From: Yonghua Huang Date: Thu, 8 Jul 2021 14:57:42 +0800 Subject: [PATCH] hv: minor coding style fix in list.h To add brakets for '(char *)(ptr)' in MACRO container_of(), which may be used recursively. Tracked-On: #6284 Signed-off-by: Yonghua Huang --- hypervisor/include/lib/list.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hypervisor/include/lib/list.h b/hypervisor/include/lib/list.h index f8c21c8ef..38103006b 100644 --- a/hypervisor/include/lib/list.h +++ b/hypervisor/include/lib/list.h @@ -119,7 +119,7 @@ static inline void list_splice_init(struct list_head *list, } #define container_of(ptr, type, member) \ - ((type *)((char *)(ptr)-offsetof(type, member))) + ((type *)(((char *)(ptr)) - offsetof(type, member))) #define list_for_each(pos, head) \ for ((pos) = (head)->next; (pos) != (head); (pos) = (pos)->next)