From: Cheng Li Date: Thu, 8 Oct 2020 18:22:34 +0000 (-0700) Subject: td_var: avoid arithmetic on a pointer to void cast (#1096) X-Git-Tag: fio-3.24~25^2 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=291945b12d15bf02c0fa63f46822e8c78325eab2;p=fio.git td_var: avoid arithmetic on a pointer to void cast (#1096) Issue 1096 shows that a compiler complains an `arithmetic on a pointer to void` error when `-Wpointer-arith` is turned on in Makefile. Although there are many violating instances, we only fix the one in `parse.h` because it is shared across many core source code files. This patch fixes the `arithmetic on a pointer to void` issue by casting it to a uintptr_t type first and perform manipulation, and then cast it back to void* type. Signed-off-by: Cheng Li --- diff --git a/parse.h b/parse.h index 1d2cbf74..e6663ed4 100644 --- a/parse.h +++ b/parse.h @@ -125,7 +125,7 @@ static inline void *td_var(void *to, const struct fio_option *o, else ret = to; - return ret + offset; + return (void *) ((uintptr_t) ret + offset); } static inline int parse_is_percent(unsigned long long val)