diff options
author | Kees Cook <kees@kernel.org> | 2025-02-06 00:45:26 +0300 |
---|---|---|
committer | Kees Cook <kees@kernel.org> | 2025-02-07 05:48:04 +0300 |
commit | 6270f4deba3fbd77d1717fb8634f1fc612ff69e2 (patch) | |
tree | c3528aa75278618d1a516781b72d73ace8bda199 /lib/overflow_kunit.c | |
parent | 20e5cc26e56db09cc612721f90b4994cce5e5b7b (diff) | |
download | linux-6270f4deba3fbd77d1717fb8634f1fc612ff69e2.tar.xz |
string.h: Use ARRAY_SIZE() for memtostr*()/strtomem*()
The destination argument of memtostr*() and strtomem*() must be a
fixed-size char array at compile time, so there is no need to use
__builtin_object_size() (which is useful for when an argument is
either a pointer or unknown). Instead use ARRAY_SIZE(), which has the
benefit of working around a bug in Clang (fixed[1] in 15+) that got
__builtin_object_size() wrong sometimes.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202501310832.kiAeOt2z-lkp@intel.com/
Suggested-by: Kent Overstreet <kent.overstreet@linux.dev>
Link: https://github.com/llvm/llvm-project/commit/d8e0a6d5e9dd2311641f9a8a5d2bf90829951ddc [1]
Tested-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Kees Cook <kees@kernel.org>
Diffstat (limited to 'lib/overflow_kunit.c')
0 files changed, 0 insertions, 0 deletions