From 71d3f9a4c0066fbc0975e991223c6232ea7ea5fb Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 22 Sep 2021 18:40:11 +0300 Subject: [PATCH] lib: container_of() - Avoid uintptr_t Using uintptr_t confused Coverity, but char* works fine. --- src/lib/macros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/macros.h b/src/lib/macros.h index d41570a282..fb5923dc3c 100644 --- a/src/lib/macros.h +++ b/src/lib/macros.h @@ -27,7 +27,7 @@ ((const void *) (((uintptr_t) (ptr)) + ((size_t) (offset)))) #define container_of(ptr, type, name) \ - (type *)((uintptr_t)(ptr) - (uintptr_t)offsetof(type, name) + \ + (type *)((char *)(ptr) - offsetof(type, name) + \ COMPILE_ERROR_IF_TYPES_NOT_COMPATIBLE(ptr, &((type *) 0)->name)) /* Don't use simply MIN/MAX, as they're often defined elsewhere in include -- 2.47.3