[PATCH v2 0/5] string: strl(cat|cpy)

Sean Anderson seanga2 at gmail.com
Thu Mar 11 06:15:40 CET 2021


This series adds support for strl(cat|cpy), and brings their implementations
in-line with what is documented in the Linux man pages. It also fixes some
potential (actual) fastboot bugs. Lastly, it adds a patman check to suggest
using these functions over strn(cat|cpy). I think these functions provide a much
better interface, which removes some footguns from U-Boot.

Changes in v2:
- Fix strlcpy return value
- Add implementation of strlcat
- Add test for strlcat
- Fix bug in fastboot
- Move check to u_boot_line

Sean Anderson (5):
  lib: string: Fix strlcpy return value
  lib: string: Implement strlcat
  test: Add test for strlcat
  fastboot: Fix possible buffer overrun
  checkpatch: Add warnings for using strn(cat|cpy)

 drivers/fastboot/fb_mmc.c       |   6 +-
 drivers/usb/dwc3/linux-compat.h |   6 --
 include/linux/string.h          |   3 +
 lib/string.c                    |  31 +++++++-
 scripts/checkpatch.pl           |   6 ++
 test/lib/Makefile               |   1 +
 test/lib/strlcat.c              | 126 ++++++++++++++++++++++++++++++++
 tools/patman/test_checkpatch.py |  14 +++-
 8 files changed, 179 insertions(+), 14 deletions(-)
 create mode 100644 test/lib/strlcat.c

-- 
2.30.1



More information about the U-Boot mailing list