Cast through uintptr_t to narrow the buf domain pointer on 32-bit archs
arg2 is an intmax_t, which on 32-bit architectures is 64 bits, wider than a pointer. When &bdomain[i] is added to arg2 it widens from uintptr_t to intmax_t, then gcc whines when it gets cast to a pointer. Casting through uintptr_t silences this warning.
This commit is contained in:
parent
bfec8330e8
commit
68f6ae368c
@ -435,7 +435,7 @@ sysctl_bufdomain_int(SYSCTL_HANDLER_ARGS)
|
||||
return (error);
|
||||
*(int *)arg1 = value;
|
||||
for (i = 0; i < buf_domains; i++)
|
||||
*(int *)(((uintptr_t)&bdomain[i]) + arg2) =
|
||||
*(int *)(uintptr_t)(((uintptr_t)&bdomain[i]) + arg2) =
|
||||
value / buf_domains;
|
||||
|
||||
return (error);
|
||||
@ -454,7 +454,7 @@ sysctl_bufdomain_long(SYSCTL_HANDLER_ARGS)
|
||||
return (error);
|
||||
*(long *)arg1 = value;
|
||||
for (i = 0; i < buf_domains; i++)
|
||||
*(long *)(((uintptr_t)&bdomain[i]) + arg2) =
|
||||
*(long *)(uintptr_t)(((uintptr_t)&bdomain[i]) + arg2) =
|
||||
value / buf_domains;
|
||||
|
||||
return (error);
|
||||
|
Loading…
Reference in New Issue
Block a user