mbox series

[v2,0/3] kernfs: Convert from strlcpy() to strscpy()

Message ID 20231130200937.it.424-kees@kernel.org (mailing list archive)
Headers show
Series kernfs: Convert from strlcpy() to strscpy() | expand

Message

Kees Cook Nov. 30, 2023, 8:12 p.m. UTC
Hi,

One of the last users of strlcpy() is kernfs, which has some complex
calling hierarchies that needed to be carefully examined. This series
refactors the strlcpy() calls into strscpy() calls, and bubbles up all
changes in return value checking for callers. Future work in kernfs and
sysfs will see the replacement of open-coded string handling with the
seq_buf API, but we need to do one thing at a time.

Thanks!

-kees

v2:
 - drop extraneous kernel/trace/trace_uprobe.c change
v1: https://lore.kernel.org/linux-hardening/20231116191718.work.246-kees@kernel.org/


Kees Cook (3):
  kernfs: Convert kernfs_walk_ns() from strlcpy() to strscpy()
  kernfs: Convert kernfs_name_locked() from strlcpy() to strscpy()
  kernfs: Convert kernfs_path_from_node_locked() from strlcpy() to
    strscpy()

 fs/kernfs/dir.c           | 53 +++++++++++++++++++++------------------
 kernel/cgroup/cgroup-v1.c |  2 +-
 kernel/cgroup/cgroup.c    |  4 +--
 kernel/cgroup/cpuset.c    |  2 +-
 4 files changed, 32 insertions(+), 29 deletions(-)