HomeFreeBSD

LinuxKPI: Implement strscpy

Description

LinuxKPI: Implement strscpy

strscpy copies the src string, or as much of it as fits, into the dst
buffer. The dst buffer is always NUL terminated, unless it's zero-sized.
strscpy returns the number of characters copied (not including the
trailing NUL) or -E2BIG if len is 0 or src was truncated.

Currently drm-kmod replaces strscpy with strncpy that is not quite
correct as strncpy does not NUL-terminate truncated strings and returns
different values on exit.

Reviewed by: hselasky, imp, manu
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D31005

Details

Provenance
wulfAuthored on Jul 5 2021, 12:20 AM
Reviewer
hselasky
Differential Revision
D31005: LinuxKPI: Implement strscpy
Parents
rG98a6984a9e10: LinuxKPI: Use macro for implementation of some dma_map_* functions
Branches
Unknown
Tags
Unknown