diff options
author | Nikolaus Rath <Nikolaus@rath.org> | 2017-01-12 15:17:54 -0800 |
---|---|---|
committer | Nikolaus Rath <Nikolaus@rath.org> | 2017-01-12 15:19:04 -0800 |
commit | 3006686b536942f6f96675e3d12b793087e78e6a (patch) | |
tree | 5e18731982bac1ce4d0fb7506a08df8f91f7d544 /example | |
parent | 9e3147feab8e313b54388df2bda8540ff2afdd02 (diff) |
Replaced evil pointer magic with offsetof()
This triggered undefined behaviour warnings from UBSan.
Diffstat (limited to 'example')
-rw-r--r-- | example/cuse.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/example/cuse.c b/example/cuse.c index 15e2d37..cfbf753 100644 --- a/example/cuse.c +++ b/example/cuse.c @@ -141,11 +141,11 @@ static void fioc_do_rw(fuse_req_t req, void *addr, const void *in_buf, /* prepare size outputs */ out_iov[0].iov_base = - addr + (unsigned long)&(((struct fioc_rw_arg *)0)->prev_size); + addr + offsetof(struct fioc_rw_arg, prev_size); out_iov[0].iov_len = sizeof(arg->prev_size); out_iov[1].iov_base = - addr + (unsigned long)&(((struct fioc_rw_arg *)0)->new_size); + addr + offsetof(struct fioc_rw_arg, new_size); out_iov[1].iov_len = sizeof(arg->new_size); /* prepare client buf */ |