From: Timo Sirainen Date: Wed, 22 Sep 2021 15:40:11 +0000 (+0300) Subject: lib: container_of() - Avoid uintptr_t X-Git-Tag: 2.3.18~322 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=71d3f9a4c0066fbc0975e991223c6232ea7ea5fb;p=thirdparty%2Fdovecot%2Fcore.git lib: container_of() - Avoid uintptr_t Using uintptr_t confused Coverity, but char* works fine. --- 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