From 1e9560e1e541629116f3db719668fb13d21588e7 Mon Sep 17 00:00:00 2001 From: Ville Juven Date: Wed, 10 May 2023 09:41:39 +0300 Subject: [PATCH] net/net_cmsg.c: Fix warning about using void* arithmetics utils/net_cmsg.c: In function 'cmsg_append': utils/net_cmsg.c:82:23: error: pointer of type 'void *' used in arithmetic [-Werror=pointer-arith] 82 | msg->msg_control += cmsgspace; | ^~ cc1: all warnings being treated as errors Using void pointers in arithmetic operations is a GCC extension, it is not supported by the standard. Because what is the size of a void ? --- net/utils/net_cmsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/utils/net_cmsg.c b/net/utils/net_cmsg.c index 25d3fc1c4a..7aa145e640 100644 --- a/net/utils/net_cmsg.c +++ b/net/utils/net_cmsg.c @@ -79,7 +79,7 @@ FAR void *cmsg_append(FAR struct msghdr *msg, int level, int type, memcpy(cmsgdata, value, value_len); } - msg->msg_control += cmsgspace; + msg->msg_control = (char *)msg->msg_control + cmsgspace; msg->msg_controllen -= cmsgspace; return cmsgdata;