The kernel expects certain global arrays' size to remain a multiple of
the array type. In particular, for kernel modules some arrays of structs
shared with userspace are sanity-checked by modpost to have a size that
is a multiple of that type:
https://elixir.bootlin.com/linux/latest/source/scripts/mod/file2alias.c#L132
Since the AddressSanitizer takes a global and replaces it with a new one
that has the redzone appended to it, any information about the global as
well as the section size is increased. Therefore, to ensure we retain
the array-size-property required for globals, calculate the redzone size
to be a multiple of the original global's size.
To improve readability, the existing redzone size calculation is
refactored into its own function; no other functional change intended.
Report: https://github.com/ClangBuiltLinux/linux/issues/1045
clang-format suggested style edits found: