mbox series

[v2,0/3] string.h: Use ARRAY_SIZE() for memtostr*()/strtomem*()

Message ID 20250206213532.it.087-kees@kernel.org (mailing list archive)
Headers show
Series string.h: Use ARRAY_SIZE() for memtostr*()/strtomem*() | expand

Message

Kees Cook Feb. 6, 2025, 9:40 p.m. UTC
Work around a Clang <15 bug by switching to ARRAY_SIZE() (with the
added benefit of explicitly checking for char array arguments) in
memtostr*/strtomem*().

 v2:
  - change __must_be_byte_array to __must_be_byte_array() (david)
  - add missed Suggested-by (kent)
  - clarify move log (miguel)
  - clarify cover letter Clang version (andy)
 v1: https://lore.kernel.org/lkml/20250206175216.work.225-kees@kernel.org/

-Kees

Kees Cook (3):
  compiler.h: Move C string helpers into C-only kernel section
  compiler.h: Introduce __must_be_byte_array()
  string.h: Use ARRAY_SIZE() for memtostr*()/strtomem*()

 include/linux/compiler.h | 32 +++++++++++++++++++-------------
 include/linux/string.h   | 12 ++++++++----
 2 files changed, 27 insertions(+), 17 deletions(-)