[igt-dev] [PATCH i-g-t] tests/i915/gem_ctx_persistence: fix gcc warning
Juha-Pekka Heikkila
juhapekka.heikkila at gmail.com
Mon Nov 11 14:23:01 UTC 2019
casting unsigned char pointer to int pointer causes gcc to be unhappy with
comment: "warning: dereferencing type-punned pointer will break
strict-aliasing rules"
Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
tests/i915/gem_ctx_persistence.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/i915/gem_ctx_persistence.c b/tests/i915/gem_ctx_persistence.c
index a582e64..2525a85 100644
--- a/tests/i915/gem_ctx_persistence.c
+++ b/tests/i915/gem_ctx_persistence.c
@@ -420,7 +420,7 @@ static void sendfd(int socket, int fd)
cmsg->cmsg_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_RIGHTS;
cmsg->cmsg_len = msg.msg_controllen;
- *(int *)CMSG_DATA(cmsg) = fd;
+ memcpy(CMSG_DATA(cmsg), &fd, sizeof(fd));
igt_assert(sendmsg(socket, &msg, 0) != -1);
}
--
2.7.4
More information about the igt-dev
mailing list