From aa214feaf3f58c31440140ab5366b3409780e85e Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 26 Aug 2021 11:47:07 -0700 Subject: [PATCH] iser: Fix a compiler warning triggered by the container_of() definition This patch fixes the following compiler warning: iser.c:338:14: error: cast from 'uint8_t *' (aka 'unsigned char *') to 'struct iser_pdu *' increases required alignment from 1 to 8 [-Werror,-Wcast-align] iser_pdu = container_of(pdu, struct iser_pdu, iscsi_pdu); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- lib/iser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/iser.c b/lib/iser.c index bbd9662..b8e49c6 100644 --- a/lib/iser.c +++ b/lib/iser.c @@ -46,7 +46,7 @@ * */ #define container_of(ptr, type, member) \ - ((type *) ((uint8_t *)(ptr) - offsetof(type, member))) + ((type *)(void *)((uint8_t *)(ptr) - offsetof(type, member))) #endif